Reputation: 2117
I have an interface
interface IInterface {}
An abstract class
abstract class AbstractClass : IInterface { }
Concrete class
class Irrelevant { Irrelevant (IInterface service) {} }
I'm writing a unit test against Irrelevant
and the abstract class already contains helpful methods I'd want to leverage for my unit test. How would I make my A.Fake<IInterface>();
inherit from AbstractClass
?
Upvotes: 2
Views: 1717
Reputation: 241790
var fake = A.Fake<AbstractClass>();
That's how FakeItEasy makes fakes - by having DynamicProxy subclass an existing class. (When an interface is faked, it subclasses System.Object.)
Upvotes: 5