March 2020
Beginner to intermediate
426 pages
13h 11m
English
Another unit testing framework that can be used for Dynamics 365 CE is Moq. This framework also provides a mock object that we can use to connect to Dynamics 365 CE service objects and perform unit testing. For example, to set up a service object, we can use the following statement:
var Dynamics365serviceMock = new Mock<IOrganizationService>(); IOrganizationService OrgService = Dynamics365serviceMock.Object;
In the preceding code, we are creating an object of the Mock type that can act like Dynamics 365 CE's organization service, which we learned about in Chapter 7, Extending Dynamics 365 CE. We can use this object to perform organization service operations.
Read now
Unlock full access