Get an exception when creating a mock object of a class (abstract). Note that it still does it if the constructor is changed from proteced to public.
Caused by following line:
TypeMock.MockObject mockDSPObjectModel1 =
TypeMock.MockManager.MockObject(typeof(DSPObjectModel));
Class outlines for DSPObjectModel and base class:
public abstract class DSPObjectModel :
ExtendedTypeDescriptor, IDSPObjectModel, IKnowMySystemName {
protected DSPObjectModel(IDSPObject dspObject) {
...
}
[Serializable]
public class ExtendedTypeDescriptor : ICustomTypeDescriptor {
public ExtendedTypeDescriptor(object helped) {
this.helped = helped;
}
public ExtendedTypeDescriptor() {
this.helped = this;
}
...
}
Exception:
Type:
System.NotSupportedException
Message:
Parent does not have a default constructor. The default constructor must be explicitly defined.
Thread:
Name '', Id = 860
StackTrace:
at System.Reflection.Emit.TypeBuilder.DefineDefaultConstructor(MethodAttributes attributes)
at System.Reflection.Emit.TypeBuilder.CreateType()
at TypeMock.s.b(Type A_0)
at TypeMock.MockManager.MockObject(Type type, Constructor mockConstructors, Object[] args)
at TypeMock.MockManager.MockObject(Type type, Object[] args)
at Servotest.D2R.Model.Test.TestItBody() in c:d2rGenericsrcModelModelSynchronizer.cs:line 452
at Servotest.UnitTest.MessagingThreadTestbed.ExceptionCatcherMethod(VoidZeroArgDelegate testDelegate) in c:d2rTestingsrcUnitTestMessagingThreadTestbed.cs:line 66