Welcome to Typemock Answers. Here you can ask and receive answers from other community members. And if you liked or disliked an answer or thread: react with an up- or downvote Enjoy!

Can I Ignore a base.<Method> call?

+1 vote

I have a method that I want to ignore the base method call. I have:

public class A : BaseA
public override void DoThis()
//Cust implementation code


I want to have typemock ignore base.DoThis(), while the derived class is called. Is that possible?

asked Oct 17, 2009 by bmains (1,810 points)

1 Answer

+2 votes
You can use the Reflective CallBase to do exactly that:
public void Test()
    Mock mock = MockManager.Mock(typeof(A))
    // mock only BaseA.DoThat when called from a DerivedClass Type.
    mock.CallBase.ExpectCall("DoThat ");
    var a = new A();
answered Oct 17, 2009 by dhelper (23,700 points)