在我的asp.net核心项目(vs 2017)中,我想运行我的测试方法,但是ı在测试资源管理器中单击'run‘,我在测试资源管理器控制台中得到"Last Not Run (Total ' bla ')“响应。我已经下载了我的Nunit NuGet软件包。我认为,在我的启动类或其他地方的asp.net核心测试中,ı缺少了一些测试配置,或者有些NuGet包丢失了:/ Thx,提前发送给每个人。
这是我的考试课:
using NUnit.Framework;
using Software_Testing.Controllers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Software_Testing.Tests
{
[TestFixture]
public class NunitTest
{
GuessService GuessService = new GuessService();
[Test]
public void GuessTest()
{
var result = GuessService.Guess("This is a test description with less then 20 words.");
Assert.AreEqual("1-3 Gün", result);
}
}
}下面是我的“猜测服务”类,它包含在测试方法(guessTest)中使用的猜测方法
public class GuessService
{
public string Guess(string desc)
{
string s = desc; //açıklamadaki kelime sayısına göre süre tahminlemesi yapılır...
string[] coutn = s.ToString().Split(' ');
int i = coutn.Count();
if (i <= 20)
{
return "1-3 Gün";
}
else if (20 < i && i <= 40)
{
return "3-5 Gün";
}
else if (40 < i)
{
return "5-7 Gün";
}
return "";
}
}下面是我的探索者:

发布于 2021-01-21 23:36:42
我自己有了解决方案:/我还没有在下面添加这个金块包:
*NUnit3TestAdapter
*Microsoft.Net.Test.Sdk
https://stackoverflow.com/questions/65837002
复制相似问题