public void Test_ValidateHistory_Fail_On_OldPassword()
        {
            var testPassword = new Password
            {
                UserId          = "ABHW089",
                OldPassword     = "******",
                NewPassword     = "******",
                ConfirmPassword = "******",
                NewPasswordHash = "B1ge@rs*",

                IsValid = true
            };

            testPassword.SetHistory(new List <string> {
                "$sG96r#X", "3g9m&9W7"
            });

            validator = new ValidateHistory();
            validator.Setup(validTestRules);

            var result = validator.Validate(testPassword);

            result.Should().NotBe(null);
            result.IsValid.Should().BeFalse();
        }
        public void Test_ValidateWhiteSpace_Not_In_RuleSet()
        {
            var testPassword = new Password
            {
                UserId          = "ABHW089",
                OldPassword     = "******",
                NewPassword     = "******",
                ConfirmPassword = "******",
                NewPasswordHash = "yVHn6 R@",

                IsValid = false
            };

            testPassword.SetHistory(new List <string> {
                "$sG96r#X", "3g9m&9W7"
            });

            validator = new ValidateWhiteSpace();
            validator.Setup(validTestRules);

            var result = validator.Validate(testPassword);

            result.Should().NotBe(null);
            result.IsValid.Should().BeFalse();
            result.Reason.Should().BeNullOrEmpty();
        }
        public void Test_ValidateHistory_Setup_Null_Parameter()
        {
            validator = new ValidateHistory();

            var result = new Action(() =>
            {
                validator.Setup(null);
            });

            result.ShouldThrow <ArgumentNullException>();
        }
        public void Test_ValidateHistory_Success()
        {
            validator = new ValidateHistory();
            validator.Setup(validTestRules);

            var result = validator.Validate(validTestPassword);

            validator.Type.Should().Be(ValidatorTypes.History);
            result.Should().NotBe(null);
            result.IsValid.Should().BeTrue();
        }
        public void Test_ValidateWhiteSpace_Null_Parameter()
        {
            validator = new ValidateWhiteSpace();
            validator.Setup(validTestRules);

            var result = new Action(() =>
            {
                validator.Validate(null);
            });

            result.ShouldThrow <ArgumentNullException>();
        }