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

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

Open
blinxsweeper opened this issue May 16, 2018 · 1 comment
Open

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

blinxsweeper opened this issue May 16, 2018 · 1 comment

Comments

@blinxsweeper
Copy link

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.

@hanslai
Copy link

hanslai commented May 17, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants