(858) 586 7777 | About | Testimonials | Contact
vteams vteams vteams vteams
  • How does it work?
    • Startup Process
    • Your First Day
  • Technologies
    • Hire PHP Developer
    • Hire App Developer
    • Hire JavaScript Developer
    • Hire ROR Developer
    • Hire IOS Developer
    • Hire .NET Developer
    • Hire AI Developer
    • Hire Robotics Engineer
  • Sample Budgets
  • Meet The Team
  • Experiments
  • Captain’s Log
  • Blog
vteams vteams
  • How does it work?
    • Startup Process
    • Your First Day
  • Technologies
    • Hire PHP Developer
    • Hire App Developer
    • Hire JavaScript Developer
    • Hire ROR Developer
    • Hire IOS Developer
    • Hire .NET Developer
    • Hire AI Developer
    • Hire Robotics Engineer
  • Sample Budgets
  • Meet The Team
  • Experiments
  • Captain’s Log
  • Blog
Blog
  1. vteams
  2. Blog
  3. Using Abstraction for Unit Testing in a Restaurant App
Oct 07
using-abstraction-for-unit-testing-in-a-restaurant-app

Using Abstraction for Unit Testing in a Restaurant App

  • October 7, 2016

Unit testing is core implementation when it comes to the well organize architecture of any application. vteam #247’s client required an application for his restaurant business that would use a combination of different design patterns. In this way, different layers could be tested as independent components and he could make sure that no other part of the project was disturbed due to the modifications in the system.

After analyzing the requirements, and keeping in mind that project layers should be testable independently, vteams came up with the following design pattern for a restaurant web based application:

  • Repository Pattern
  • Unit Of Work
  • Dependency Injection
    .

The interface plays an important role to build a loosely coupled architecture, because it shows an abstraction of a system. So, vteams prepared a Data Access Layer, using repositories, with interface implementation in order to expose operations which were required either by the Service Layer or directly by the web application. By implementing the Repository pattern, vteams achieved the following benefits:

  1. Query logic centralized
  2. Reusable functionality
    .

unit-testing-1

To protect the modifications made to the payment gateway, in case of future updates or insertions in multiple tables, Unit Of work was implemented. This would either successfully commit or rollback the transaction, in case of failure by using different repositories in the project.

Now, the data access layer was separated in a library project, which can be used in any other project/class library due to its abstraction. The Restaurant application was developed using ASP.NET MVC, with C# programming language so as to behave for the developed class library as a client. vteams wanted to avoid any instance of a Repository directly within the controller class. This is where Dependency Injection comes in; it injects the concrete implementation into the abstraction and allows lose coupling between the Repository layer and web application.

unit-testing-2

AutoFac was used as Dependency container, which can inject the concrete implementation within the controller constructor. By using the instance of repository, the can client can achieve any level of a particular functionality through operations. Ultimately vteams achieved the primary goal by preparing different layer using abstraction for the client.

  • Facebook
  • Twitter
  • Tumblr
  • Pinterest
  • Google+
  • LinkedIn
  • E-Mail

Comments are closed.

SEARCH BLOG

Categories

  • Blog (490)
  • Captain's Log (1)
  • Closure Reports (45)
  • Experiments (7)
  • How-To (56)
  • Implementation Notes (148)
  • Learn More (156)
  • LMS (8)
  • Look Inside (10)
  • Operations Log (12)
  • Programmer Notes (20)
  • R&D (14)
  • Rescue Log (4)
  • Testimonials (25)
  • Uncategorized (4)

RECENT STORIES

  • GitHub Actions- Automate your software workflows with excellence
  • Yii Framework – Accomplish Repetitive & Iterative Projects with Ease
  • A Recipe for CRM Software Development
  • Are Agile and DevOps the same?
  • The Data Scientist’s Toolset

ARCHIVES

In Short

With the vteams model, you bypass the middleman and hire your own offshore engineers - they work exclusively for you. You pay a reasonable monthly wage and get the job done without hassles, re-negotiations, feature counts or budget overruns.

Goals for 2020

  • Open development center in Australia
  • Complete and Launch the Robot
  • Structural changes to better address Clients' needs

Contact Us

Address: NEXTWERK INC.
6790 Embarcadero Ln, Ste 100,
Carlsbad, CA 92011, USA

Tel: (858) 586 7777
Email: fahad@nextwerk.com
Web: www.vteams.com

© 2020 vteams. All Rights Reserved.

Content Protection by DMCA.com