Build/Test Issues

Does Ncrunch support Shim scope

Started by chadit on 6,522 views

If I add the following test when using MSTEST

[TestMethod]
[ExpectedException(typeof(Y2KException))]
public void EndOfWorldCheckerTest()
{
// scope the shim otherwise it will fail, this is so it does not last forever.
using (ShimsContext.Create())
{
var asyncClass = new AsyncExamples();
ShimDateTime.NowGet = () => new DateTime(2000, 1, 1);
asyncClass.CheckIfEndOfWorld();
}
}
}


I get this error

Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: UnitTestIsolation instrumentation failed to initialize. Please restart Visual Studio and rerun this test

I have restarted, and Test Explorer shows that the test passes.
Hi, thanks for posting!

Right now NCrunch doesn't yet support working with MS Fakes Shims, as these rely on a certain profiler to be loaded into the test environment. Support is currently planned for NCrunch Version 2.


Cheers,

Remco

Post a reply

Log in to reply.