我试图单元测试,我创建了一个可移植类库,我想,以确保它正在测试使用相同的框架子集,它的目标。
I am attempting to unit test a Portable Class Library that I've created and I want to make sure it's being tested with the same framework subset that it targets.
Per在Visual Studio ALM + Team Foundation Server的博客,在MSTest的单元测试框架,转变为在Visual Studio 2012 RC一个PCL;但是,我无法创建一个可移植类库然后引用VS2012 RTM的MSTest的框架。
Per the Visual Studio ALM + Team Foundation Server blog, the MSTest unit test framework was converted to a PCL in Visual Studio 2012 RC; however, I am unable to create a portable class library and then reference the MSTest framework in VS2012 RTM.
在浏览中的引用对话框中显示我没有单元测试组件注册为PCL兼容。 添加在项目文件中手动GAC参考 Microsoft.VisualStudio.QualityTools.UnitTestFramework
产生参考未找到生成错误。
添加一个手工装配直接参照 C: Program Files文件(x86)的微软的Visual Studio 11.0Common7IDEReferenceAssembliesv4.0Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll产生一个生成警告称UnitTestFramework集引用一个不兼容的的mscorlib
版本。
Browsing in the "References" dialog shows me that no unit testing components are registered as compatible with PCL.
Adding a manual GAC reference in the project file to Microsoft.VisualStudio.QualityTools.UnitTestFramework
yields a reference not found build error.
Adding a manual direct assembly reference to C:Program Files (x86)Microsoft Visual Studio 11.0Common7IDEReferenceAssembliesv4.0Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
yields a build warning saying the UnitTestFramework assembly references an incompatible mscorlib
version.
我发现(感谢早期的答案),有一个项目类型单元测试库(Windows应用商店的应用程序)
引用了不同的 MSTest的大会 C: Program Files文件(x86)的微软SDKsWindowsv8.0ExtensionSDKsMSTestFramework11.0ReferencesCommonConfigurationneutralMicrosoft.VisualStudio.TestPlatform.UnitTestFramework.dll.此项目类型创建一个小的无用户界面的Windows商店应用程序......完整的清单和一切。它也不会允许我指定框架我针对 - 它似乎对Windows应用商店的应用程序只有
I did find (thanks to an early answer) that there is a project type Unit Test Library (Windows Store apps)
that references a different MSTest assembly at C:Program Files (x86)Microsoft SDKsWindowsv8.0ExtensionSDKsMSTestFramework11.0ReferencesCommonConfigurationneutralMicrosoft.VisualStudio.TestPlatform.UnitTestFramework.dll
. This project type creates a small no-UI Windows Store app... complete with manifest and everything. It also doesn't allow me to specify which frameworks I'm targeting - it appears to be only for Windows Store apps.
在潜在的故障的假设,我应该与单元测试组件针对同一个框架子集作为库所试验测试我的便携式类库项目...
Under the potentially faulty assumption that I should be testing my Portable Class Library projects with unit test assemblies that target the same framework subset as the library-under-test...
如何创建单元测试组件.NET可移植类库?
(我愿意接受其他框架也针对PCL,我只是目前尚不知情除了MSTest的其他解决方案,已经考虑到这一点。)
(I am open to other frameworks that also target PCL, I'm just currently unaware of other solutions besides MSTest that have taken this into account.)
推荐答案
的xUnit现在有PCL单元测试支持; http://xunit.github.io/
xUnit now has support for PCL unit testing; http://xunit.github.io/
相关推荐
最新文章