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:
我的Visual Studio 2012 Update 2也安装了Resharper.如何解决此异常?
小智 3
自 2012 年 11 月起,您无法同时运行 Resharper 和 MS Fakes。大约一年前就提出了使其兼容的请求。
http://devnet.jetbrains.com/message/5470396?tstart=0
| 归档时间: |
|
| 查看次数: |
2712 次 |
| 最近记录: |