微软正版正货和垫片与NUnit的 [英] Microsoft Fakes and Shims with nunit
问题描述
我想测试UserService的,我想用Fakes.ShimsContext假日期时间好像是在告诉这页面
I'm trying to test userservice and I want to fake datetime using Fakes.ShimsContext like it was told on this page
在测试执行我收到
UnitTestIsolation仪器初始化失败。请重新启动 Visual Studio和重新运行该测试
UnitTestIsolation instrumentation failed to initialize. Please restart Visual Studio and rerun this test
任何不同的是,我使用NUnit的框架。
Any difference is that I'm using nunit framework.
有没有什么问题,我应该使用NUnit与Microsoft伪造品和垫片?
Is there any issues I should be aware when using nunit with Microsoft Fakes and Shims?
推荐答案
请确保您使用的是Visual Studio的测试运行,而不是在NUnit的,MSTest的,或ReSharper的测试运行。正版正货需要的权限来测试您的code,如果你的测试runnner不具备这种能力,或许可,它会失败,你只得到了错误。
Make sure you're using the Visual Studio test runner and not the nUnit, MSTest, or Resharper test runners. Fakes requires permission to instrument your code, if your test runnner doesn't have that capability or permission, it'll fail with the error you just got.
您还需要运行微软的Visual Studio Ultimate或premium版,如果你是在Windows 8或8.1,你需要运行在管理模式。不能使用专业版运行假货。
You also need to be running Microsoft Visual Studio Ultimate or Premium edition, and if you're in Windows 8 or 8.1 you need to be running in admin mode. You cannot use Professional edition to run Fakes.
如果你仍然有问题,检查事件查看器,它应该有一个它也许可以通过工作或张贴在这里让我们来帮助你工作,通过相应的异常。
If you're still having issues, check the Event Viewer, it should have a corresponding exception which maybe you can work through or post here for us to help you work through.
这篇关于微软正版正货和垫片与NUnit的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!