Hi,
I'd like to test the implementation of the my abstract class, but I'm not able to intercept the constructor of the base class.
Here the snippet code:
public abstract class Base{ public virtual void Start(IContext context) { \\ do something }}public class Child : Base{ public override void Start(IContext context) { \\ do something }}
I'd like to test it like this:
private Base mBase;private Child mPlugin;[TestInitialize]public void Initialize(){ mBase = Mock.Create<Base>(Constructor.Mocked); mPlugin = new Child();}[TestMethod]public void TestStart(){ IContext mockContext = Mock.Create<IContext>(); Mock.Arrange(() => mBase.Start(mockContext)).DoNothing(); // test plugin code mPlugin.Start(mockContext);}
What is wrong?
Thanks,
Ste