c# - Microsoft Fakes 生成 UnitTestIsolationException

标签 c# visual-studio-2012 microsoft-fakes

我编写了非常简单的单元测试项目来查看 Microsoft Fakes 的能力。我在系统程序集上执行了菜单命令“添加假程序集”。

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();
        }
    }
}

但是在使用 (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。如何解决这个异常?

最佳答案

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

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

关于c# - Microsoft Fakes 生成 UnitTestIsolationException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20686805/

相关文章:

c# - 导入命名空间并使用它们的层次结构

visual-studio - 微软假货 "Assembly not supported"

c# - 将数组中的每个元素相互比较

c# - 如何将 NancyFX 从 1.2 版更新到 1.4.4 版

c# - 具有整数值的 IFormatProvider

c# - Visual Studio 2012/VS11 是否有自定义语言加载项?

visual-studio-2012 - Visual Studio 11 beta 是否缺少 "Add Deployable Assemblies"菜单选项?

c# - 无法使用 Microsoft.QualityTools.Testing.Fakes.Shims.ShimNotSupportedException 填充 WebException

c# - Microsoft Fakes x64 而不是 x86 和 v4.5

c# - 按其属性的属性值对 PropertyInfos 列表进行排序