示例#1
0
            public void Validate_GivenAllPropertiesAreValid_ExpectValidationSuccess()
            {
                var cmd = new SecurityKeys.Model {
                    Name = "name", Password = "******"
                };
                var validator = new SecurityKeys.Validator();
                var result    = validator.Validate(cmd);

                Assert.True(result.IsValid);
            }
示例#2
0
            public void Validate_GivenPasswordIsEmpty_ExpectValidationFailure()
            {
                var cmd = new SecurityKeys.Model {
                    Name = "name", Password = string.Empty
                };
                var validator = new SecurityKeys.Validator();
                var result    = validator.Validate(cmd);

                Assert.False(result.IsValid);
                Assert.Contains(
                    result.Errors,
                    failure => failure.PropertyName == "Password");
            }
示例#3
0
            public void Validate_GivenNameIsNull_ExpectValidationFailure()
            {
                var cmd = new SecurityKeys.Model {
                    Name = null, Password = "******"
                };
                var validator = new SecurityKeys.Validator();
                var result    = validator.Validate(cmd);

                Assert.False(result.IsValid);
                Assert.Contains(
                    result.Errors,
                    failure => failure.PropertyName == "Name");
            }