R
R
rundll322021-09-17 01:03:27
C++ / C#
rundll32, 2021-09-17 01:03:27

Can't run test method in NUnit?

MSDN had an example with method testing. To do this, it was proposed to create a NET Standard class library, so I did, installed the NUnit package and wrote the simplest method:

[TestFixture]
    public static class TestClass
    {
        [Test]
        public static void TestMethod()
        {
            int a = 10, b = 5;
            Assert.Equals(a,b);
        }
    }

The test has appeared in the test browser, but running it does not lead to anything.
6143be89ce7a7621350461.jpeg
I googled the possible problem a lot, tried to install the NUnit3TestAdapter package in the same way, compiled the solution, deleted the obj and bin folders, finally changed the project type to a console application and added the Main method, even this did not solve the problem. Really, everything works for everyone without dancing with a tambourine?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-09-17
@rundll32

I always created a project for tests from a template and there were no problems)
https://docs.microsoft.com/ru-ru/dotnet/core/testi...
For NUnit, it seems that you need to install Runner and Adapter, and there are several of them, and which one is needed - you need to either guess or read.
And you also need to install Microsoft.NET.Test.SDK

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question