예제 #1
0
        public void Validate_GivenAllPropertiesAreValid_ExpectValidationSuccess()
        {
            var cmd       = new RevokeAuthenticatorAppCommand("password");
            var validator = new RevokeAuthenticatorAppCommandValidator();
            var result    = validator.Validate(cmd);

            Assert.True(result.IsValid);
        }
예제 #2
0
        public void Validate_GivenPasswordIsNull_ExpectValidationFailure()
        {
            var cmd       = new RevokeAuthenticatorAppCommand(null);
            var validator = new RevokeAuthenticatorAppCommandValidator();
            var result    = validator.Validate(cmd);

            Assert.False(result.IsValid);
            Assert.Contains(
                result.Errors,
                failure => failure.ErrorCode.Equals(ValidationCodes.FieldIsRequired) &&
                failure.PropertyName == "Password");
        }