I have the following line of code for mocking SampleClass
SampleClass mockInst =
RecorderManager.CreateMockedObject<SampleClass>(Constructor.Mocked) as SampleClass;
It throws an exception of type TypeMockException with the following message
"Cannot mock constructor of COM types. Set constructor of DMPinMapClass to original behavior".
If the change this code like below error is not thrown
SampleClass mockInst =
RecorderManager.CreateMockedObject<SampleClass>(Constructor.NotMocked) as SampleClass;
Instead error is thrown in the following record block line number two.
MockContextManager contextMgr = new MockContextManager ();
using (RecordExpectations recorder = RecorderManager.StartRecording ())
{
dummy = contextMgr.FindSheet<SampleClass>();
recorder.Return(mockInst);
}
SampleClass is a COM class and I dont want itz constructor to be mocked. But I need the FindSheet to return a mocked instance of it with out any error. Could anyone help me in this