The specified object is not recognized as a fake object. Issue
Asked Answered
A

1

23

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(); 
Ambriz answered 5/4, 2012 at 18:16 Comment(2)
You should post your resolution as an answer and accept it.Faro
I have to wait 8 hours, I'm not cool enough to do that yet ;).Ambriz
A
24

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

A.CallTo(() => myService.MyMethod(listOfStringsFilter)).MustHaveHappened();
Ambriz answered 7/6, 2012 at 21:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.