New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to create a Fake #1044
Comments
Thanks for sharing the scenario! As usual, may I ask you to provide Minimal, Complete, and Verifiable example, so I can copy-paste it to deeply investigate the reason? The devil is often in some specifics, so even if you described the scenario good, it could still happen that some non-mentioned detail matters. Thanks a lot in advance! 😌 |
Sorry, I should have gone and created another (possibly pair of) projects - I was hoping my question may have prompted something obvious before I went off and did that as it would have involved converting my wrapper methods into raw AutoFixture / FakeItEasy code. The good news is I seem to have fixed it. The I already had I don't recall what the latter does but the errors are now all gone. |
Good news the issue is mitigated
I know 😄 It's related to the Fakes and |
I understand. With the decades of experience I have I should know better - I've been in the same boat and ask the very same. Thanks for the responses. |
I'm in the process of updating a project I was working on a few years ago. In the process I have updated to the latest of FakeItEasy and AutoFixture.
I have 40 tests that are failing with an error similar to:
AutoFixture was unable to create an instance from
FakeItEasy.Fake
1[System.Collections.Generic.IList1[AllOverIt.Evaluator.AoiFormulaTokenProcessorContext]]
because creation unexpectedly failed with exception.Where the inner exception reports:
Failed to create fake of type System.Collections.Generic.IList
1[AllOverIt.Evaluator.AoiFormulaTokenProcessorContext]`The line that's failing is the equivalent of this:
Fixture.Create<Fake<IList<AoiFormulaTokenProcessorContext>>>();
As a test I tried something simpler:
Fixture.Create<Fake<IList<int>>>();
This did not throw so I went looking at the constructor of
AoiFormulaTokenProcessorContext
. It looks like this:public AoiFormulaTokenProcessorContext(Func<char, bool, bool> predicate, Func<char, bool, bool> processor)
After some reading at #984 I tried adding 'GenerateDelegates' to this:
Fixture.Customize(new AutoFakeItEasyCustomization {GenerateDelegates = true});
But I've still got the same problem.
As this code was working I can only assume there's another breaking change somewhere that I haven't yet stumbled across. Hoping someone can throw a suggestion or two my way.
TIA.
The text was updated successfully, but these errors were encountered: