Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ok, trying again. I hope that this PR is now OK - there are only 2 files changed.
The fix for #409 is to revert the order of the items of the invocations list in he FluentMockContext before disposing the items. The new test runs into a situation, that there are at least 2 MockInvocations created on the mock which is constructed with DefaultValue.Empty. The first one remembers the original DefalutValue (Empty) and sets it to Mock. The second one remembers the current value of DefaultValue (Mock) and sets it to the Mock, too. Now, if the MockInvocations are disposed in the same order as they were created, the first MockInvocation will set the DefaultValue of the mock back to the value it remembered - Empty. Then the second MockInvocation is disposed and sets the DefaultValue to the Mock, as this is the one that it remembered. By reverting the disposal order we make sure that the DefaultValue is reverted back to the original value before the first MockInvocation was constructed.