私はインターフェースを持っていますIFoo
public interface IFoo
{
void DoSomeStuff();
}
そして、私は2つの派生型FooImpl1
とを持っていますFooImpl2
:
public class FooImpl1 : IFoo
{
public void DoSomeStuff()
{
//...
}
}
public class FooImpl2 : IFoo
{
public void DoSomeStuff()
{
//Should do EXACTLY the same job as FooImpl1.DoSomeStuff()
}
}
IFoo
私はの契約をテストするテストクラスを持っていますFooImpl1
:
private static IFoo FooFactory()
{
return new FooImpl1();
}
[Fact]
public void TestDoSomeStuff()
{
IFoo foo = FooFactory();
//Assertions.
}
このテスト クラスを再利用して と の両方をテストするにはどうすればよいFooImpl1
ですFooImpl2
か?