I wrote a very simple unit test project to see the features of Microsoft Fake. And I ran the Add Fakes Assembly menu command on the system assembly.
public static class Y2KChecker { public static void Check() { if (DateTime.Now == new DateTime(2000, 1, 1)) throw new ApplicationException("y2kbug!"); } } [TestClass] public class UnitTest1 { [TestMethod] public void TestYear() { using (ShimsContext.Create()) { ShimDateTime.NowGet = () => new DateTime(2000, 1, 1); Y2KChecker.Check(); } } }
But when using the string (ShimContext.Create ()), a UnitTestIsolationException always occurs:
Unexpected error returned by SetDetourProvider in the profiler library 'C: \ Program Files \ Microsoft Visual Studio 11.0 \ Common7 \ IDE \ CommonExtensions \ Microsoft \ IntelliTrace \ 11.0.0 \ Microsoft.IntelliTrace.Profiler.11.0.0.dll'.
In my version of Visual Studio 2012 Update 2, Resharper is also installed. How to fix this exception?
source share