Unit testing custom Microsoft Dynamics CRM code – Part 7 (web requests)

One of the main points of all my unit testing posts is that unit tests should be written so that you can test your code without needing to rely on external resources, and, we’ve been able to use Moq as a stand-in for Dynamics CRM’s related services without too much trouble. »

Unit testing custom Microsoft Dynamics CRM code – Part 8 (exception raising)

This is the final post in my series on unit testing custom Microsoft Dynamics CRM code in which I’ve been showing how you can unit test custom C# code that interacts with Microsoft Dynamics CRM using Visual Studio’s unit testing tools and Moq. We’ve looked at several different scenarios thus far, but none of them included the method under test throwing an exception. »

Unit testing custom Microsoft Dynamics CRM code – Part 6 (plug-ins)

In my last post, I showed how to unit test a Microsoft Dynamics CRM custom workflow activity using Visual Studio and Moq. In this post I will show you how to unit test a Dynamics CRM plug-in. For this example we’ll be using the sample FollowupPlugin class in the CRM 2011 SDK, but the principles I will demonstrate are applicable to any plug-in. »

Unit testing custom Microsoft Dynamics CRM code – Part 5 (custom workflow activities)

In the last three posts of this series, I showed how to unit test Microsoft Dynamics CRM C# interfaces code with mock objects using Visual Studio 2012 and Moq. In this post, I will show how to unit test custom workflow activities that are executed by Dynamics CRM processes. I will be using the regular expression validation custom workflow activity I showed in my “Using regular expressions in Dynamics CRM 2011 processes” post. »

Unit testing custom Microsoft Dynamics CRM code – Part 4 (using a wrapper class)

In parts two and three of this series, I gave an introduction to unit testing Dynamics CRM C# interfaces code with mock objects using Visual Studio 2012 and Moq, and I showed code samples for a couple of different scenarios. In this post I will show how to work with CRM metadata (optionset values, statuscode values, etc. »