It is necessary to check implementation of 'MyMethod' virtual method in the abstract 'MyAbstractClass':
public abstract MyAbstractClass { public void MyMethod() { Testpassed = true; } public abstract int StatusCode{get;internal set;} // **EDIT**: internal setter was added public bool TestPassed{get;private set;} }
I've tried to do the following:
[TestMethod()] { Mock<MyAbstractClass> mockClass = new Mock<MyAbstractClass>(); mockClass.Object.MyMethod(); Assert.IsTrue(mockClass.Object.TestPassed); }
on attempt to execute 'MyMethod' the following error is generated:
Method 'set_StatusCode' in type 'MyAbstractClass`2Proxy0434d60c0f4542fb9b4667ead4ca3a18' from assembly 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation..
Please advise, how could I get the problem resolved?
Thanks a lot!
P.S. Actually, I could inherit from MyAbstractClass and provide implementation for 'StatusCode' property, but I have a bunch of properties to be implemented...