如何将现有程序集转换为ms单元测试程序集?

编程入门 行业动态 更新时间:2024-10-25 18:26:05
本文介绍了如何将现有程序集转换为ms单元测试程序集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在Visual Studio 2010 Pro中,如何轻松将经典程序集转换为ms单元测试程序集?

In Visual Studio 2010 Pro, how can I easily convert a classic assembly to a ms unit test assembly ?

.csproj文件中是否有要激活的标志?

It there a flag to activate in the .csproj file ?

推荐答案

问题是测试项目在项目文件上被标记"了-您可以按照以下四个简单步骤将类库转换为Test项目:

The problem is that test projects are "marked" on the project file - you can convert a class library to Test project follow these four simple steps:

  • 卸载项目(.prj)文件,然后将其打开以进行更新.
  • 将以下行添加到项目中C#:

  • Unload the project (.prj) file and then open it for update.
  • add the following line to the project C#: <Project> <PropertyGroup> <AssemblyName>....</AssemblyName> <!-- add this line below --> <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> </PropertyGroup> </Project>

    VB-< ProjectTypeGuids> {3AC096D0-A1C2-E12C-1390-A8335801FDAB}; {F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>

    请注意,您将需要手动添加对Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll的引用,以便能够使用与测试相关的属性

    更新:在即将推出的MSTest V2中,这将不再是必需的,因为MSTest成为一个NuGet程序包,其工作方式与NUnit/XUnit一样

    Update: In the upcoming MSTest V2 this will not be nesessery as MSTest becomes a NuGet package which works just like NUnit/XUnit

  • 更多推荐

    如何将现有程序集转换为ms单元测试程序集?

    本文发布于:2023-11-14 11:30:50,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1587097.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:程序   转换为   如何将   单元测试   ms

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!