I'm currently writing unit tests using Microsoft Fakes framework. I've noticed that if I don't supply a delegate for a given property, the default value is returned. However, when initializing my shim I change this behavior to NotImplemented.
var myShim = new ShimMyClass
{
InstanceBehavior = ShimBehaviors.NotImplemented
}
This is the given behavior I want for all my shims I define. I'd like to be able to set this default at a more global level, instead of having to remember to do it for every shim I create. Is this possible?
According to documentation, the following code snippet could help you:
using (ShimsContext.Create())
{
ShimBehaviors.Current = ShimBehaviors.NotImplemented;
var myShim = new ShimMyClass
{
...
}
}
However, it doesn't work on my machine with VS2012. Perhaps it is a bug.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With