Hi Everyone,
I am facing one issue while writing unit test cases for organization requests in CRM plugins. I have to write the unit test case for the below code but the properties "Processes" and "Entities" of "RetrieveProcessInstancesResponse" are read only and I couldn't assign values for these properties from my unit test case. I know we should create a wrapper class for this response to solve this issue but I couldn't figure out how to write wrapper class for the nested properties (for ex. Entities in my scenario) in "RetrieveProcessInstancesResponse" class.
public static Entity GetRunningBpfInstanceId(IOrganizationService service , string objectId, string entityName, ITracingService logger) { var bpfInstance = new RetrieveProcessInstancesRequest { EntityId = new Guid(objectId), EntityLogicalName = entityName }; var proResp = (RetrieveProcessInstancesResponse)service.Execute(bpfInstance); return proResp?.Processes.Entities?.FirstOrDefault() ?? null; }
Any help would be appreciated.
Note: I am using "Microsoft Fakes Unit Test Framework” with Stub type.