In my case I decided to go to NUnit download page page and download NUnit directly (NUnit.3.2.1.msi).
Start new console application. In the solution add new class library. Then, in that class library add reference to NUnit, in my case file is:
C:\Program Files (x86)\NUnit.org\framework\3.2.1.0\net-4.5\nunit.framework.dll
Also add reference in class library to console application (application which we are going to test)
We will also need NUnit Test Adapter, in order to see our tests in test explorer.
Go to Tools -> Extensions and Updates
Go to online and search for NUnit3 Test Adapter - in my case I needed NUnit3 because of VS 2015
Install it. Restart VS. Code in console application which I am going to test looks like:
namespace NUnit { public class Program { static void Main(string[] args) { } public string ATest() { return "Hello World"; } } }
Class library looks like:
using NUnit.Framework; using NUnit; namespace NUnitTest { [TestFixture] public class HelloWorldTest { Program source; [SetUp] public void Init() { source = new Program(); } [Test] public void ShouldShowHelloWorld() { Assert.AreEqual("Hello World", source.ATest()); } } }
Now rebuild solution. Open Test Explorer (Test -> Window -> Test Explorer)
And run all tests: