Introduction
This is the first post of a series containing collections of patterns and code fragments showing how various unit frameworks can be used in Dynamics CRM 2011 development.
Unit test with server side components, (web service, plugin, workflow), will be explained with Microsoft Fakes, Rhino Mocks and Moq.
Unit test with client side JavaScript will be explained with QUnit.
The complete sample code using Microsoft Fakes can be downloaded from MSDN sample gallery: Dynamics CRM unit test using Microsoft Fakes
Series Contents
Part 1: Introduction and Series Contents
- Introduces the topics that will be covered in the series
Part 2: Microsoft Fakes with LINQ query
- Unit test CRM LINQ query
- Mock System.Linq namespace
- Mock Mock OrganizationServiceContext.CreateQuery
- Mock OrganizationServiceContext
- Create SaveChangesResultCollection
- Create SaveChangesResult
Part 4: Microsoft Fakes with CrmOrganizationServiceContext
- Mock CrmOrganizationServiceContext
Part 5: Microsoft Fakes with LINQ query through IOrganizationService
- Mock IOrganizationService to isolate LINQ to CRM query
Part 6: Microsoft Fakes with OrganizationServiceContext through IOrganizationService
- Isolate method call to OrganizationServiceContext through mocking IOrganizationService
Part 7: Microsoft Fakes with CrmOrganizationServiceContext through IOrganizationService
- Isolate method call to OrganizationServiceContext extension methods through mocking IOrganizationService
- Isolate method call to CrmOrganizationServiceContext through mocking IOrganizationService
Part 8: Microsoft Fakes with IOrganizationService
- Using Stub type to isolate method call to IOrganizationService
Part 9: Microsoft Fakes with CRM plugin
- Mock IOrganizationService, IPluginExecutionContext, ITracingService, IOrganizationServiceFactory and IServiceProvider
Part 10: Microsoft Fakes with workflow activity
- Correctly invoke CodeActivity.Execute(CodeActivityContext executionContext)
- Correctly pass in InArgument<T> properties
- Pass in required service as extensions
Part 11: QUnit with client side JavaScript
- QUnit
- Xrm.Page Script Library Template (Microsoft Visual Studio extension)
Part 12: Rhino Mocks with LINQ query, OrganizationServiceContext and CrmOrganizationServiceContext
Part 13: Rhino Mocks with IOrganizationService
Part 14: Rhino Mocks with CRM plugin
Part 15: Rhino Mocks with workflow activity
Part 16: Moq with LINQ query, OrganizationServiceContext and CrmOrganizationServiceContext
Part 17: Moq with IOrganizationService
Part 18: Moq with CRM plugin
Part 19: Moq with workflow activity
Pingback: Dynamics CRM 2011 Unit Test Part 1: Introduction and Series Contents - Zhongchen Zhou's Dynamics CRM Tips, Tricks and Portal Development - CRM Technical Blogs - Microsoft Dynamics Community
Pingback: Dynamics CRM 2011 Unit Test Part 2: Microsoft Fakes with LINQ query | Zhongchen Zhou's Blog
Pingback: Dynamics CRM 2011 Unit Test Part 3: Microsoft Fakes with OrganizationServiceContext | Zhongchen Zhou's Blog
Pingback: Dynamics CRM 2011 Unit Test Part 4: Microsoft Fakes with CrmOrganizationServiceContext | Zhongchen Zhou's Blog
Pingback: Dynamics CRM 2011 Unit Test Part 5: Microsoft Fakes with LINQ query through IOrganizationService | Zhongchen Zhou's Blog
Pingback: Part 6: Microsoft Fakes with OrganizationServiceContext through IOrganizationService | Zhongchen Zhou's Blog
Pingback: Dynamics CRM 2011 Unit Test Part 7: Microsoft Fakes with CrmOrganizationServiceContext through IOrganizationService | Zhongchen Zhou's Blog
Pingback: Dynamics CRM 2011 Unit Test Part 8: Microsoft Fakes with IOrganizationService | Zhongchen Zhou's Blog
Pingback: Dynamics CRM 2011 Unit Test Part 9: Microsoft Fakes with CRM plugin | Zhongchen Zhou's Blog
Pingback: Dynamics CRM 2011 Unit Test Part 10: Microsoft Fakes with workflow activity | Zhongchen Zhou's Blog
Pingback: Dynamics CRM 2011 Unit Test Part 10: Microsoft Fakes with workflow activity - Zhongchen Zhou's Dynamics CRM Tips, Tricks and Portal Development - CRM Technical Blogs - Microsoft Dynamics Community
Have you looked at http://crm2011plugintest.codeplex.com/ ? I prefer to use this to mock IServiceProvider.
Pingback: How I develop and unit test CRM 2011 plugins - Gold Coast - Site Home - MSDN Blogs
Pingback: Dynamics CRM 2011 Unit Test Part 11: QUnit with client side JavaScript | Zhongchen Zhou's Blog
Pingback: Dynamics CRM 2011 Unit Test Part 11: QUnit with client side JavaScript - Zhongchen Zhou's Dynamics CRM Tips, Tricks and Portal Development - CRM Technical Blogs - Microsoft Dynamics Community
Pingback: Dynamics CRM 2011 Unit Test Part 14: Rhino Mocks with CRM plugin | Zhongchen Zhou's Blog
Pingback: Dynamics CRM 2011 Unit Test Part 14: Rhino Mocks with CRM plugin - Zhongchen Zhou's Dynamics CRM Tips, Tricks and Portal Development - CRM Technical Blogs - Microsoft Dynamics Community