First, I want to clarify that this question is not a dup of this because the situation is different when you have an abstract class.
My situation is that there exists a base class
public abstract class FooBase
{
public FooBase(FooBase inner) { /* ... */ }
public virtual void DoSomething() { /* ... */ }
}
which is in a different assembly and I want to mock the behavior of DoSomething()
. The problem is that if I try to create a mock
public class MockFoo : FooBase
{
public MockFoo(...) : base(/*I have to put a FooBase in here*/) { /* ... */ }
}
I can't pass a new MockFoo()
into base
because it'll cause an infinite recursion. Any other ideas I have (such as creating another MockFooOuter
) can't get around the infinite recursion problem.
Aucun commentaire:
Enregistrer un commentaire