I've updated the sample to a Visual Studio 2012 solution and created a separate test project (LucasDemoCrm.Test) that contains the NUnit tests. Additionally I have created another test project (LucasDemoCrm.VSTest) that has the same unit tests written to use the Visual Studio Unit Testing Framework. If you are looking for the original VS2010 version, you can download it here: LucasDemoCrm.zip.
This sample contains the solution I used for my three-part blog series on unit testing C# interfaces with Dynamics CRM 2011 using NUnit and Moq. There are three methods in the MockDemo class:
These methods and their corresponding tests show how to unit test CRM interfacing code in progressively more advanced scenarios.
The sample builds a class library that can then be tested using the NUnit GUI or command-line interface. To build the sample you will need:
All three are included in the "references" directory in the solution archive. To execute the tests, see the "Running the test" section toward the end of this article.
Each test in this sample demonstrates how to unit test a Dynamics CRM interface without actually needing to connect to a live CRM system.
A detailed overview of the contents of this sample can be found in the original blog posts: