Skip to content

When a method/property is setup with the same argument, raise a warning #36

@GillesTourreau

Description

@GillesTourreau

When a method/property is setup with the same arguments, only the last Setup() will be use:

For example, here the result variable will return 2 because the second Setup() is used.

var stream = new Mock<Stream>(MockBehavior.Strict);
stream.Setup(s => s.Seek(10, SeekOrigin.Begin))
    .Returns(1);
stream.Setup(s => s.Seek(It.IsAny<long>(), It.IsAny<SeekOrigin>()))
    .Returns(2);

var result = stream.Object.Seek(10, SeekOrigin.Begin);

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions