This project is read-only.

Create a Unit Test Project

Once the Visual Studio Extension has been installed, you should find a few more new Dynamics CRM project templates:


This template will bring the required Dynamics CRM assembly references from NuGet (see "packages.config" file) and it will give you an initial guidance with the folders you could use.

Once we have created the Unit Test project as we saw previously, we are ready to add our unit tests for Plugins and custom workflow activities.

The xRM Test Framework currently support both Microsoft Fakes and Moq. If you want to use Microsoft Fakes then you will need to generate the Fakes Libraries as per below.

Expand the References. Select "Microsoft.Xrm.Sdk" then "Add Fakes Assembly":


Repeat this for the Assemblies:
  • Microsoft.Xrm.Sdk.Workflow
  • System
  • Other if needed (Plugins, Custom WF Activities, Common Libraries, etc...)

The next screenshot is based on our Framework Sample solution, whose code is completely available and where you can find a real scenario of how to use and create your different tests. Add you can see a Fakes folder has been generated containing all the Stub & Shims required to Fakes the CRM runtime and your custom business logic.


Next steps:

Last edited Jun 26, 2014 at 10:42 AM by waelhamze, version 11


No comments yet.