(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. Microsoft Fakes And Shims: Unit Testing Without Database Dependency
Jun 22

Microsoft Fakes And Shims: Unit Testing Without Database Dependency

  • June 22, 2015

An application architecture was developed by vteam #366 to test all its functionality and APIs, a separate Test Project was serving this purpose. As per Client’s requirement, we had to develop a test driven approach that could work without actual data store/database dependency and generate dummy values to be used instead of actual data from the database.

Problem:

The problem faced by vteam #366 was that Client refused to share the actual data from database to test code. Reason being, he did not want his actual and sensitive data to be shared and used for testing purpose in few scenarios and modules.

Solution:

There are different Open Source mocking frameworks available that can be used to complete this requirement in .NET like NMock, Rhino Mocks, Moq etc., but Microsoft Fakes is a mocking framework provided by Microsoft itself. That is why, it was used by vteam #366 for this scenario where test stubs and shims were created to replace the actual code and parts of the application dealing with database calls. This framework is mainly used to isolate the code under test. Following were the basic steps followed and an example where shims types were used to replace the actual database calls:

  • Add Fakes Assembly
  • Use ShimsContext
  • Write a test with Shims

microsoft-fakes-1microsoft-fakes-2Conclusion:

vteam #366 identified during the deployment process that one need to have Visual Studio Premium or Ultimate Edition installed on the specific machine to use this framework, which is the major drawback as it is pretty costly. But on the other hand,  this framework also have some advantages as well which are as follows:

  • No more need to find and install open source mocking frameworks
  • Easy implementation and replacement of calls to any assembly
  • Extensive support available as compared to open source projects

 

  • 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