I was attempting to use FakeItEasy recently but I wasn't able to create a Fake from a concrete class without working around many quirks.
I tried the following:
public class MyObject {
public MyObject(){}
}
...
MyObject fakeObject = A.Fake<MyObject>();
Which resulted in the a Constructor Not Found with Matching Arguements Exception
Next I tried:
public class MyObject {
public MyObject(string temp){}
}
...
MyObject fakeObject = A.Fake<MyObject>(x => x.WithArgumentsForConstructor(() => new MyObject("temp")));
Which resulted in a similar error.
Finally I tried:
public class MyObject {
//public MyObject(){}
}
...
MyObject fakeObject = A.Fake<MyObject>();
Which allowed me to finally create the fake. I'm confused as to why most of the examples of faking a concrete class allude this is easier that I've found it to be? And why using the documented method, trial #2 above, didn't work?
Are there some limitations to faking a concrete class that aren't documented?