Unit Testing (Microsoft Fakes) RetrieveSharedPrincipalsAndAccessResponse in Plugin in CRM 2016 (and earlier)

Nishant Rana's Weblog

Hi,

While trying to write Fakes for RetrieveSharedPrincipalsAndAccessResponse we’d realize that PrincipalAccess is read only property and the class itself is sealed.

So to unit test it we need to write a wrapper class as suggested here

http://alexanderdevelopment.net/post/2013/10/17/unit-testing-custom-microsoft-dynamics-crm-code-part-4/

The wrapper class

The unit test

Change in the Plugin code using Wrapper instead of original class

Hope it helps

View original post

Published by Sreeni Pavalla

Working as a Assistant Technical Manager in Positive Edge Technologies. Having over 11 years of extensive hands-on experience in MS Dynamics CRM 4.0, 2011, 2013, 2015, 2016, Dynamics 365 with over 5 years of experience in CRM Online. You can visit my blog here https://sreenipavalla.me/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: