Microsoft Fakes生成UnitTestIsolationException
我编写了非常简单的unit testing项目来查看Microsoft Fakes的function。 我已经在系统组件上执行了菜单命令“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(); } } }
但是在使用(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。 如何修复此exception?
截至2012年11月,您无法同时运行Resharper和MS Fakes。 大约一年前提出了使其兼容的请求。
https://devnet.jetbrains.com/message/5470396?tstart=0
到现在为止(2014年3月),您只能在Visual Studio Test Runner(vstest.console.exe)中运行使用MS Fakes的测试。 当然你可以继续使用ReSharper,但是它的测试运行者无法运行你的测试。
我在使用VS2012 + ReSharper时遇到了同样的问题,我在没有ReSharper的情况下切换到VS2013并且工作得很好。
我回到VS2012并试图暂停ReSharper,但这并没有解决问题。
就我而言,问题只发生在TeamCity。
我通过从MSTest切换到VSTest来解决。
截至2017年10月,我能够通过Resharper运行测试,但在收集代码覆盖率时则无法运行
上述就是C#学习教程:Microsoft Fakes生成UnitTestIsolationException分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/cdevelopment/1004603.html