Skip to content
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

Internal interception on a mock changes the DefaultValue property #409

Closed
vladonemo opened this issue Jul 10, 2017 · 1 comment
Closed

Comments

@vladonemo
Copy link
Contributor

Let's consider this use case:

public void DefaultValueIsNotChangedWhenPerformingInternalInvocation()
{
	var mockBar = new Mock<IBar> { DefaultValue = DefaultValue.Empty };
	var mockFoo = new Mock<IFoo>();
	mockFoo.SetupSet(m => m.Bar = mockBar.Object);
	Assert.Equal(DefaultValue.Empty, mockBar.DefaultValue);
}

The SetupSet changes the DefaultValue of the mockBar to DefaultValue.Mock.

I'm submitting a PR shortly.

vladonemo added a commit to vladonemo/moq4 that referenced this issue Jul 10, 2017
…ions in the FluentMockContext to restore the DefaultValue of mocks back to the original value.
vladonemo added a commit to vladonemo/moq4 that referenced this issue Jul 11, 2017
vladonemo added a commit to vladonemo/moq4 that referenced this issue Jul 11, 2017
stakx pushed a commit that referenced this issue Jul 11, 2017
@stakx
Copy link
Contributor

stakx commented Jul 11, 2017

Your fix has been merged. Thank you for correcting this! :)

@stakx stakx closed this as completed Jul 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants