Can't create a loose mock when default behavior is strict
blinxsweeper opened this issue · comments
blinxsweeper commented
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.
Hans Lai commented
黎汉石 Hans Lai
新感觉卫生用品有限公司
New Sensation Sanitary Product Co., LTD
均安 (0757) 66883199
乐从 (0757) 66882881
www.nssp.biz
…On Wed, May 16, 2018 at 12:09 PM, blinxsweeper ***@***.***> wrote:
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.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#42>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATn468YgScRdX6aHDMcsg5S2qQZhE3Klks5ty6Z1gaJpZM4UAnh4>
.