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

Originally posted on 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 /// <summary> /// Wrapper class for retrieve…