As part of Test Driven Development and in order to write nUnit tests which achieves maximum code coverage it very important to have the ability to mock the external dependencies which in turn helps writing nunit tests which are environment independent. The importance of unit tests first to test code logic without relying on a database and even later in the development life cycle maintaining a DB just for unit testing could be both cumbersome and erroneous. whereas having a DB for automated unit testing with automated build process may introduce unnecessary complexity. However the default ADO.NET Entity Data Model code generation template does not support wrtiting nUnit tests out of the box. Hence to strengthen and simplify your unit test implementation this code generation template is a handy tool without any maintenance. This template generates a strongly-typed Object Context and POCO entities from the EDMX file along with the interface and mock repositories to write nUnit tests. This will allow you to mock the entities call as well as the stored procedure (function import) calls. Please visit my blog @ http://sunilbemarkarprogramming.blogspot.in/
|