Can Microsoft Fakes be used in Visual Studio 2010?

耗尽温柔 提交于 2019-12-09 08:35:47

问题


We have developers using Visual Studio 2010 professional and some trying out Visual Studio 2012. Project compatibility between the two versions has been good.

Will a Visual Studio project still be compatible with 2010 if we introduce the new Fakes Framework for unit testing?


回答1:


Currently Microsoft Fakes does not work in VS 2010. Project will compile however tests which use Fakes throw NotSupportedException with following stack trace.

at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.InvokeEvent(T value, Action`1 eh)
at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.OnAttachedUnsupportedMethod(MethodBase method)
at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.CheckInstrumentation(MethodBase method)
at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.InternalAttachDetour(Object optionalReceiver, MethodBase method, Delegate detourDelegate)
at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.AttachDetour(Object optionalReceiver, MethodBase method, Delegate detourDelegate)

I would suggest to use Moles, which is the prior version of Microsoft Fakes. Here is great article about moving from Moles to Fakes.



来源:https://stackoverflow.com/questions/11009477/can-microsoft-fakes-be-used-in-visual-studio-2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!