Ejemplo n.º 1
0
        public void Validate_GivenAllPropertiesAreValid_ExpectValidationSuccess()
        {
            var cmd       = new DeleteRoleCommand(TestVariables.RoleId);
            var validator = new DeleteRoleCommandValidator();
            var result    = validator.Validate(cmd);

            Assert.True(result.IsValid);
        }
Ejemplo n.º 2
0
        public void Validate_GivenRoleIdIsEmpty_ExpectValidationFailure()
        {
            var cmd       = new DeleteRoleCommand(Guid.Empty);
            var validator = new DeleteRoleCommandValidator();
            var result    = validator.Validate(cmd);

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