Microsoft Fakes生成UnitTestIsolationException

Vas*_*kin 6 c# microsoft-fakes visual-studio-2012

我编写了非常简单的单元测试项目来查看Microsoft Fakes的功能.我已经在系统组件上执行了菜单命令"Add Fakes 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();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

但是在使用(ShimContext.Create())时,我总是得到UnitTestIsolationException:

在探查器库"C:\ Program Files\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\IntelliTrace\11.0.0\Microsoft.IntelliTrace.Profiler.11.0.0.dll"中由SetDetourProvider返回意外错误.

我的Visual Studio 2012 Update 2也安装了Resharper.如何解决此异常?

小智 3

自 2012 年 11 月起,您无法同时运行 Resharper 和 MS Fakes。大约一年前就提出了使其兼容的请求。

http://devnet.jetbrains.com/message/5470396?tstart=0