2

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?

johnildergleidisson
  • 2,087
  • 3
  • 30
  • 50

1 Answers1

5
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.)

Blair Conrad
  • 233,004
  • 25
  • 132
  • 111
  • This wasn't quite the question I wanted to ask - was in a rush to leave the office and ended up writing the wrong question. I did accept it because it was the right answer, thank you!!! – johnildergleidisson Feb 24 '15 at 14:04
  • I created a new question with what I actually wanted: http://stackoverflow.com/questions/28697918/fakeiteasy-having-an-interface-fake-inherit-from-abstract-while-both-share-sam – johnildergleidisson Feb 24 '15 at 14:09