无法发现 NUnit 测试用例

Unable to discover NUnit test case

我正在尝试使用 Nunit 来测试我的简单程序,但我不知道为什么它不能发现我的测试用例...编译结果是通过

这是我的代码:

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();
        }
    }
}

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"));

            }

        }
    }
}

如果您正在使用 Nunit 3.*,则需要安装 NUnit3 Test Adapter。 对于 Nunit 2.* - NUnit Test Adapter.

在 Visual Studio 中转到 Tools -> Extensions and Update -> Online 并找到所需的适配器。