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

Non-static method requires a target #13

Open
kentcb opened this issue Aug 11, 2015 · 1 comment
Open

Non-static method requires a target #13

kentcb opened this issue Aug 11, 2015 · 1 comment

Comments

@kentcb
Copy link
Owner

kentcb commented Aug 11, 2015

A verification along the lines of:

mock
    .Verify(x => x.SomeCall(It.Matches(y => y.SomeNullableThing.HasValue)))
    .WasCalledExactlyOnce();

results in an exception:

System.Reflection.TargetException: Non-static method requires a target

A simple workaround in this specific example is to change to:

mock
    .Verify(x => x.SomeCall(It.Matches(y => y.SomeNullableThing != null)))
    .WasCalledExactlyOnce();

NOTE: tested on mono only (Xamarin/iOS).

@kentcb kentcb added the bug label Sep 9, 2015
kentcb added a commit that referenced this issue Sep 19, 2015
This works fine in .NET proper - only an issue for mono then, which will hopefully be rectified as they adopt more of the Microsoft OS stack.
@kentcb
Copy link
Owner Author

kentcb commented Sep 19, 2015

This affects mono only. I've added a test to prove it works under MS .NET. Hopefully this will sort itself out as the mono team adopt Microsoft OS code.

@kentcb kentcb added the on hold label Sep 19, 2015
@kentcb kentcb added the mono label Mar 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant