如何用NUnit(C#)替换MSTest
作者:互联网
如何用NUnit(C#)替换MSTest?
解决方法:
>将nuget包NUnit包添加到测试项目中
Install-Package NUnit
>删除对Microsoft.VisualStudio.QualityTools.UnitTestFramework的引用
>从更改以下名称空间
using Microsoft.VisualStudio.TestTools.UnitTesting;
至
using NUnit.Framework;
>搜索并替换以下内容:
[TestClass] => [TestFixture]
[ClassInitialize] => [TestFixtureSetUp]
[ClassCleanup] => [TestFixtureTearDown]
[TestInitialize] => [SetUp]
[TestCleanup] => [TearDown]
[TestMethod] => [Test]
Assert.Ignore => Assert.Inconclusive
>卸载项目,以.ml格式打开.csproj文件,并删除如下所示的行:
<ProjectTypeGuids>{0b19334d-acce-4bf9-9475-088436fada27};{a9df11a7-84ef-49d2-b13a-9ed7e1f913e6}</ProjectTypeGuids>
>删除(或替换)私有或内部修饰符
标签:nunit,mstest,c 来源: https://codeday.me/bug/20191120/2042602.html