简体   繁体   English

无法发现NUnit测试用例

[英]Unable to discover NUnit test case

I'm trying use Nunit to test my simple program, but I dont know why it cannot discover my test cases... Compile result is pass 我正在尝试使用Nunit测试我的简单程序,但我不知道为什么它无法发现我的测试用例...编译结果通过

Here are my code: 这是我的代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;

namespace ConsoleApplication2
{
    class FizzBuzz
    {
        public static string TestTarget(int parameters)
        {
            return parameters.ToString();
        }
    }
}

and

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;

namespace ConsoleApplication2
{
    class FizzBuzzTest
    {
        [TestFixture]
        public class fizzBuzzTest
        {
            [Test]
            public void TestCase1()
            {
                Assert.That(FizzBuzz.TestTarget(1), Is.EqualTo("1222"));

            }

        }
    }
}

If you are using Nunit 3.* you need to install NUnit3 Test Adapter . 如果您使用的是Nunit 3.*需要安装NUnit3 Test Adapter For Nunit 2.* - NUnit Test Adapter . 对于Nunit 2.* - NUnit Test Adapter

In Visual Studio go to Tools -> Extensions and Update -> Online and find needed adapter. 在Visual Studio中,转到“ Tools -> Extensions and Update -> Online ,找到所需的适配器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM