-
-
Notifications
You must be signed in to change notification settings - Fork 794
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
Upgrade from 4.2.1409.1722 to 4.2.1507.0118 changed VerifyAll behavior #191
Comments
Could you please provide a complete and bare-bones interface definition and accompanying (single) unit test with the relevant setup which fails? Thanks! |
Hey @kzu, thanks for the reply. I went through the process of creating a stand alone solution to reproduce the problem and discovered an additional detail. The problem manifests when chaining into a subdependency on setup where that subdependency has a get-only property exposed on the interface. Here's the repo code:
Here is the Test output:
This was a new solution in Visual Studio 2013 Update 4 targeting the .Net 4.5.2 framework. Here are the references used by the project:
|
Any update available on this? |
Nop. It might be worth it to just verify what you really expect to have happened |
That's disappointing since this works fine with a long range of previous versions. I'm not really interested to rewriting an entire unit test suite to adopt a new version of Moq. I hope this get addressed. |
You can always stay with whichever version works for you. Moq is pretty much a community driven project at this point, and it may be Thanks |
Marking as up-for-grabs since it doesn't seem to be a high-impact one. |
Having the same issue. About 200 tests started to failing. And just to upgrade all packages to latest version I need to replace 200 VerifyAll on verifiable()/Verify |
@ce-smith: I realise this was posted long ago, but I'd like to add my ¢2. Here's your unit test, abbreviated and slightly reordered:
Two things are crucial for understanding why this test succeeded in version 4.2.1409.1722 but started failing in version 4.2.1507.118:
PR #137 (which was included in Moq 4.2.1502.911) addressed that bug, meaning that all properties now get set up by If you're asking to bring back the old behavior, that's essentially the same as saying, "Make The only and perhaps most reasonable way forward is to consider a different breaking change, namely that a setup for an expression such as |
Due to the decision made in #681 and the corresponding change made to /cc @ce-smith, @NecroFilja, @Arithmomaniac |
VerifyAll() fails for setups that weren't created following the upgrade. In particular, any mock made from an interface containing a get-only property fails on not satisfying a set on that property. All failing tests do not have setups for the methods/properties being reported as not matched.
where IDbContext is defined:
Additionally, there seems to be a recursive traversal of properties that are somehow getting automatically wired up as a setup. Here, IConfigurationManager defined as:
Any tests using a mock of type IConfigurationManager produces the following failure message:
The text was updated successfully, but these errors were encountered: