darrencauthon / AutoMoq

Auto mocking provider for Moq.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

blinxsweeper opened this issue · comments

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.