Tag: 假冒

FakeItEasy – 有一个接口伪inheritance自abstract,而两者共享相同的接口inheritance

我有一个界面 public interface IInterface { void DoSomething(); } 另一个界面 public interface IOtherInterface : IInterface { } 一个抽象类 public abstract class AbstractClass : IInterface { public void DoSomething() { Console.WriteLine(“Got here”); } } 我正在编写unit testing并伪造IOtherInterface。 抽象类已经包含了我想要用于unit testing的有用方法。 我如何制作A.Fake(); inheritance自AbstractClass ? 这是我到目前为止尝试但它不起作用 – AbstractClass.DoSomething没有被击中。 IOtherInterface fake = A.Fake(builder => builder.Implements(typeof (AbstractClass))); fake.DoSomething(); 当然,如果我做一个像这样的代理: var abstractFake = A.Fake(); […]