I have used LINQ query to fetch the records in workflow using OrganizationServiceContext. So now I wanted to Mock the OrganizationServiceContext using MOQ DLL. Has anyone done this before?
*This post is locked for comments
I have used LINQ query to fetch the records in workflow using OrganizationServiceContext. So now I wanted to Mock the OrganizationServiceContext using MOQ DLL. Has anyone done this before?
*This post is locked for comments
Hi,
Please see the link below. It describes how to mock OrganizationServiceContext using Moq.dll for unit testing of plugins or workflows.
alexanderdevelopment.net/.../unit-testing-custom-microsoft-dynamics-crm-code-part-5
Hope this helps.
Thanks for the reply but I want to Mock the OrganizationServiceContext for unit testing of workflow.
hi,
You need to Add Microsoft.xrm.sdk.client Reference first and then Initialize OrgContext like following
OrganizationServiceContext orgServiceContext = new OrganizationServiceContext(service);
Hope it helps you,
Thanks.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,235 Most Valuable Professional
nmaenpaa 101,156