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

It.Is is not always implicit when it should be #1

Closed
kentcb opened this issue Jan 11, 2015 · 1 comment
Closed

It.Is is not always implicit when it should be #1

kentcb opened this issue Jan 11, 2015 · 1 comment
Assignees
Labels
Milestone

Comments

@kentcb
Copy link
Owner

kentcb commented Jan 11, 2015

This works as expected:

var mock = new SomeMock();
mock.When(x => x.SomeMethod("foo")).Return("bar");

Assert.Equal("bar", mock.SomeMethod("foo"));

This does not:

var mock = new SomeMock();
var obj = new object();
mock.When(x => x.SomeMethod(obj)).Return("bar");

Assert.Equal("bar", mock.SomeMethod(obj));
@kentcb kentcb added the bug label Jan 11, 2015
@kentcb kentcb self-assigned this Jan 11, 2015
@kentcb
Copy link
Owner Author

kentcb commented Jan 11, 2015

Investigation has shown this to be a flaw in the ArgumentFilterVisitor. In some circumstances (such as the second scenario shown above), the object passed into the method invocation is wrapped in a compiler-generated type. Thus, it will be necessary to detect this scenario and "unwrap" the actual object.

@kentcb kentcb added this to the v0.0.5 milestone Jan 12, 2015
@kentcb kentcb closed this as completed in 3cdfc97 Jan 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant