NUnit
From Logic Wiki
Revision as of 14:49, 7 June 2015 by Macrop (Talk) (Created page with "Category:Tests Category:MVC Category:CSharp == Starting Up == * install nUnit nuget packages * Add a new class project * Right click "References" add project refe...")
Starting Up
- install nUnit nuget packages
- Add a new class project
- Right click "References" add project reference to test project
Simple Test
using NUnit.Framework;
using Logicom.Models;
namespace Logicom.Tests.Security
{
[TestFixture]
public class password_policyTests
{
password_policy sut = new password_policy(1, 8, 1, 1, 1, 1, 1, 3, 3);
[Test]
public void ShouldRejectPasswordIfItsLessThenMinLenght()
{
var result = sut.CheckPassword("Passwor"); // 7 char long
Assert.That(result = false, "it's rejected");
}
[Test]
public void ShouldRejectPasswordIfItsLessThenMinLenght()
{
var result = sut.CheckPassword("Passwor"); // 7 char long
Assert.That(result, Is.EqualTo(true));
}
}
}