I recommend that you have your own project for your tests (e.g. Project.Tests ).
Put the following base files somewhere in the folder of your project structure (e.g. lib\nunit\nunit ):
nunit.core.dllnunit.core.interfaces.dllnunit.framework.dllnunit.util.dllnunit-console.exenunit-console.exe.confignunit-console-runner.dllnunit-console-x86.exenunit-console-x86.exe.config
Then you need to reference the NUnit.Framework assembly in your Project.Tests project.
For example, a simple test would look like this:
using NUnit.Framework; namespace Project.Tests { [TestFixture] public class MyTestClass { [Test] public void MyTestMethod() { var a = "a"; var b = "a"; Assert.AreEqual(a, b); } } }
You can run this test, for example, using NUnit-console or directly in VisualStudio (for example, using ReSharper ) or using the MSBuild task using the MSBuild Community Tasks .
source share