Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The specified object is not recognized as a fake object. Issue

I am having an issue where a FakeItEasy call in an extremely simple test is failing with the error "The specified object is not recognized as a fake object." The call is simple:

A.CallTo(myService.MyMethod(listOfStringsFilter)).MustHaveHappened();

The fake is similarly simple (A.Fake()), and fakes out an interfance with one method, that takes in a list and returns a list. In debug mode, I see the instance of myService is of type {Fake IMyInterface}. Anyway, this issue is really holding me up, thanks in advance for your help.

Update:

This was my own darn mistake, I needed to make the call say:

A.CallTo(() => myService.MyMethod(listOfStringsFilter)).MustHaveHappened(); 
like image 559
jdscolam Avatar asked Apr 05 '12 18:04

jdscolam


1 Answers

This was my own darn mistake, I needed to make the call say:

A.CallTo(() => myService.MyMethod(listOfStringsFilter)).MustHaveHappened();
like image 170
jdscolam Avatar answered Nov 08 '22 03:11

jdscolam