I'm new to unit testing and started with MSTest and want to use NUnit. I see there is a Test project template in VS 2015 but I read that for NUnit I'm to create a class library then add the NUnit NuGet packages.
What is correct? Test Project Template or Class Library for NUnit in C#?
Thank you
There is no NUnit test project template in Visual Stusio that comes out of the box.
A test project is a class library with a reference to nunit.framework.dll that comes with NUnit installation.
You can create your own NUnit project template in Visual Studio:
Your Test.cs File should look something like this:
using System;
using NUnit.Framework;
namespace NUnit.Tests
{
[TestFixture]
public class SuccessTests
{
[SetUp] public void Init()
{ /* ... */ }
[TearDown] public void Dispose()
{ /* ... */ }
[Test] public void Test1()
{ /* ... */ }
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With