1.open visual studio editor
2.click tools menu
3.select Nuget package Manager >package manager console
4. In console it will show PM>prompt
5.create your unit test project i,e library project where u going to write unit test case.
6.choose unit test project name from package manager console window
7.execute following commands one by one
PM>Install-Package Nunit -Version 3.8.1
PM>Install-Package Nunit3TestAdapter -Version 3.8.0
PM>Install-Package Nunit.ConsoleRunner -Version 3.8.0
Sample example program here:
using NUnit.Framework;
using Prime.Services;
namespace Prime.UnitTests.Services
{
[TestFixture]
public class PrimeService_IsPrimeShould
{
private readonly PrimeService _primeService;
public PrimeService_IsPrimeShould()
{
_primeService = new PrimeService();
}
[Test]
public void ReturnFalseGivenValueOf1()
{
var result = _primeService.IsPrime(1);
Assert.IsFalse(result, "1 should not be prime");
}
}
}
2.click tools menu
3.select Nuget package Manager >package manager console
4. In console it will show PM>prompt
5.create your unit test project i,e library project where u going to write unit test case.
6.choose unit test project name from package manager console window
7.execute following commands one by one
PM>Install-Package Nunit -Version 3.8.1
PM>Install-Package Nunit3TestAdapter -Version 3.8.0
PM>Install-Package Nunit.ConsoleRunner -Version 3.8.0
Sample example program here:
using NUnit.Framework;
using Prime.Services;
namespace Prime.UnitTests.Services
{
[TestFixture]
public class PrimeService_IsPrimeShould
{
private readonly PrimeService _primeService;
public PrimeService_IsPrimeShould()
{
_primeService = new PrimeService();
}
[Test]
public void ReturnFalseGivenValueOf1()
{
var result = _primeService.IsPrime(1);
Assert.IsFalse(result, "1 should not be prime");
}
}
}