Skip to content

Can't create a loose mock when default behavior is strict #42

Open
@blinxsweeper

Description

@blinxsweeper

The GetMock() method has a default value of MockBehavior.Default but the problem is that in this enumerable, MockBehavior.Default and MockBehavior.Loose have the exact same value.

From Moq sources:
public enum MockBehavior
{
Strict,
Loose,
Default = Loose,
}

So when the default behavior is MockBehavior.Strict and you call GetMock(MockBehavior.Loose) it's the same as calling GetMock(MockBehavior.Default) and it ends up creating a strict mock (which is the default), instead of a loose mock as requested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions