Hi there.
I'm using Isolator 6 and have noticed something odd. I'm testing some CRM 4.0 code which makes use of the CRM BusinessEntity object. So in my unit test, I have this snippet:
FakeBusinessEntity = Isolate.Fake.Instance<BusinessEntity>();
I then use this fake like so:
Isolate.WhenCalled(() => DataImportUtils.GetEntityByIdAndName(null, Guid.Empty, null)).WillReturn(FakeBusinessEntity);
When I debug and step through the code, I notice that GetEntityByIdAndName() is mocked and returns the fake business entity object, but the type of the object is 'Mock0001BusinessEntity' and not 'BusinessEntity'.
Does anyone know why Isolator is renaming the type? The problem is that I have another routine in the code which is now failing with this message:
System.InvalidCastException: Unable to cast object of type 'Mock0001BusinessEntity' to type 'Microsoft.Crm.Sdk.DynamicEntity'.
I'm also faking a IWorkflowContext object and the same problem happens with that, in that the typename starts with 'Mock0001'. This problem is only happening for the CRM related objects.
Cheers.
Jas.