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...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


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));
        }

    }
}