I created a project in Visual Studio for unit testing using the nuget package of nunit. The test runs well in Visual Studio using the test explorer, but i Need to run them using the nunit3 console.
My project is very simple I:
- Created a console project in C#
- I Installed Nunit and NUnitTestAdapter using NuGet Package Manager.
I create a class called MyMath.cs with the next code:
namespace NunitDemo { class MyMath { public int add(int a, int b) { return a + b; } public int sub(int a, int b) { return a - b; } } }
I create a MyTestCase Class with the following code to test MyMath methods:
using NUnit.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NunitDemo { [TestFixture] class MyTestCase { [TestCase] public void Add() { MyMath math = new MyMath(); Assert.AreEqual(31, math.add(20, 11)); } [TestCase] public void Sub() { MyMath math = new MyMath(); Assert.AreEqual(9, math.sub(20, 11)); } } }
I rebuild my solution and using The test explorer panel I can run my test in Visual Studio without problems.
But I need to run my test using the nunit3-console prompt, So, How Can I generate (Or Where Is) a DLL file to run test from the console o using nunit-gui?
I search inside C:\Users\Manuel\source\repos\ConsoleAppForNunit\ConsoleAppForNunit\bin\Debug but there is not a suitable .DLL