public void TestLenght(string password) { var result = pass.Verify(password); Assert.IsTrue(result); Assert.GreaterOrEqual(password.Length, 8); }
public void Verify_ThreeOk_ShouldReturnTrue() { var sut = new PasswordVerifier(); var result = sut.Verify("Abcdefgh1"); Assert.IsTrue(result); }
public void TestBadMultiple(string password) { PasswordVerifier p = new PasswordVerifier(); string actual = p.Verify(password); string expected = "INVALID password"; Assert.Equal(expected, actual); }
public void Verify_PasswordIsNull_ShouldThrow() { var sut = new PasswordVerifier(); var exception = Assert.Throws <ArgumentException>(() => sut.Verify(null)); Assert.That(exception.Message, Does.StartWith("Value cannot be null.")); }
public void Verify_PasswordHasNoCapital_ShouldThrow() { var sut = new PasswordVerifier(); var exception = Assert.Throws <ArgumentException>(() => sut.Verify("abcdefghij")); Assert.That(exception.Message, Does.StartWith("Should contain uppercase")); }
public void Verify_PasswordNotEightLong_ShouldThrow() { var sut = new PasswordVerifier(); var exception = Assert.Throws <ArgumentException>(() => sut.Verify("abc")); Assert.That(exception.Message, Does.StartWith("Not long enough")); }
public void Verify_PasswordHasNoLowerCase_ShouldThrow() { var sut = new PasswordVerifier(); var exception = Assert.Throws <ArgumentException>(() => sut.Verify("ABCDEFGHIJ")); Assert.That(exception.Message, Does.StartWith("Should contain lowercase")); }
public void Verify_PasswordHasNoNumber_ShouldThrow() { var sut = new PasswordVerifier(); var exception = Assert.Throws <ArgumentException>(() => sut.Verify("ABcDEFGHIJ")); Assert.That(exception.Message, Does.StartWith("Should contain at least one number")); }
public void ThrowExceptionIfPasswordConditionsAreNotSatisfied(string password) { var verifier = new PasswordVerifier(); Action result = () => verifier.Verify(Password.From(password)); result.Should().Throw <ArgumentException>(); }
public void ThrowExceptionIfPasswordDoesntHaveLowerCase(string password) { var verifier = new PasswordVerifier(); Action result = () => verifier.Verify(Password.From(password)); result.Should().Throw <ArgumentException>().WithMessage("Password must have at least one lower case letter."); }
public void ThrowExceptionIfPasswordIsNullOrEmptyString(string password) { var verifier = new PasswordVerifier(); Action result = () => verifier.Verify(Password.From(password)); result.Should().Throw <ArgumentException>().WithMessage("Password must be provided."); }
public void TestWeakBAD2() { PasswordVerifier p = new PasswordVerifier(); string actual = p.Verify("c"); string expected = "INVALID password"; Assert.Equal(expected, actual); }
public void TestWeakOK() { PasswordVerifier p = new PasswordVerifier(); string actual = p.Verify("coregame"); string expected = "VALID password"; Assert.Equal(expected, actual); }
public void Verify_PassNonNullArg_ReturnResultOfVerification() { PasswordVerifier verifier = new PasswordVerifier(); string arg = Convert.ToString(TestContext.DataRow["arg"]); bool expectedResult = Convert.ToBoolean(TestContext.DataRow["result"]); bool actualResult = verifier.Verify(arg); Assert.AreEqual(expectedResult, actualResult, "expected and actual results are not equal.\n arg = " + arg + "\nexpected = " + expectedResult + "\nactual = " + actualResult); }
public void Password_Verifier_Handles_Empty_Password() { Action action = () => _passwordVerifier.Verify(string.Empty); Exception exception = Assert.Throws <Exception>(action); Assert.Equal("Password must not be null or empty", exception.Message); }
public void Verify_PassNull_ThrowNullArgumentException() { PasswordVerifier verifier = new PasswordVerifier(); try { verifier.Verify(null); } catch (ArgumentNullException) { return; // the test passes } catch (Exception) { Assert.Fail("the thrown exception is not ArgumentNullException"); } Assert.Fail("exception is not thrown"); }
public void Verify_NullInput_Throws() { var ex = Assert.Throws <ArgumentException>(() => PasswordVerifier.Verify(null)); StringAssert.Contains("cannot be null", ex.ToString()); }
public void Verify_AllSatisfied_True() { bool result = PasswordVerifier.Verify("aSddddddddddddd1dddd"); Assert.AreEqual(true, result); }
public Tuple <bool, string> VerifyTest(PasswordVerifier verifier, string password) { return(verifier.Verify(password)); }
public void Verify_LogerThan8Chars_True() { bool result = PasswordVerifier.Verify("1234567890"); Assert.AreEqual(true, result); }
public void Verify_ShorterThan8Chars_Throws() { var ex = Assert.Throws <ArgumentException>(() => PasswordVerifier.Verify("aaaa")); StringAssert.Contains("too short", ex.ToString()); }
public void Verify_AllUpper_Throws() { var ex = Assert.Throws <ArgumentException>(() => PasswordVerifier.Verify("ASDDDDDDDDDDDDDDDDDD1DDDDDDDDD")); StringAssert.Contains("at least one lowercase character", ex.ToString()); }