You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our existing code base, we have lots of mocks, some being created specifically with MockBehavior.Strict as their constructor parameter, but most with the parameterless constructor which implies calling with MockBehavior.Default.
While the current situation is fine, we would like to experiment setting all mocks to Strict mode and were looking for a way to globally say Default is Strict in our project(s) instead of the current Default is Loose.
This is not possible at the moment, mostly because MockBehavior defines Default = Loose
If this was changed so that Default has its own distinct value, the constructor could then do something like this:
Where GlobalDefaultMockBehavior has MockBehavior.Loose by default but can be changed by a method yet to be written. Setting it via a flag in the assembly definition would be nice.
Obviously, any new value set into GlobalDefaultMockBehavior has no impact on existing Mock<T> instances, and thread safety of such a global value is nonexistent and should be documented as such.
I have seen Issue #1230 but I believe the request here is not for the same use case.
The text was updated successfully, but these errors were encountered:
In our existing code base, we have lots of mocks, some being created specifically with
MockBehavior.Strict
as their constructor parameter, but most with the parameterless constructor which implies calling withMockBehavior.Default
.While the current situation is fine, we would like to experiment setting all mocks to
Strict
mode and were looking for a way to globally sayDefault
isStrict
in our project(s) instead of the currentDefault
isLoose
.This is not possible at the moment, mostly because
MockBehavior
definesDefault = Loose
If this was changed so that
Default
has its own distinct value, the constructor could then do something like this:Where
GlobalDefaultMockBehavior
hasMockBehavior.Loose
by default but can be changed by a method yet to be written. Setting it via a flag in the assembly definition would be nice.Obviously, any new value set into
GlobalDefaultMockBehavior
has no impact on existingMock<T>
instances, and thread safety of such a global value is nonexistent and should be documented as such.I have seen Issue #1230 but I believe the request here is not for the same use case.
The text was updated successfully, but these errors were encountered: