Skip to content

Non-static method requires a target #13

Description

@kentcb

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).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions