Example #1
0
        public void ShouldRequireMinimumFields()
        {
            var user    = ReturnUser();
            var command = new Create.Command();

            // Test FluentValidation fields
            _validator = new Create.CommandValidator();
            // Should_have_error_when_Field_is_Empty()
            var result = _validator.TestValidate(command);

            result.ShouldHaveValidationErrorFor(group => group.GroupName);
            result.ShouldHaveValidationErrorFor(group => group.Description);
            // result.ShouldHaveValidationErrorFor(group => group.IsPublic);
            result.ShouldHaveValidationErrorFor(group => group.CreatedAt);
            result.ShouldNotHaveValidationErrorFor(group => group.Id);
        }
Example #2
0
        public void ShouldRequireMinimumFields()
        {
            var user    = ReturnUser();
            var command = new Create.Command();

            // No groupId on command will throw RestException since group == null

            // Test FluentValidation fields
            _validator = new Create.CommandValidator();
            // Should_have_error_when_Field_is_Empty()
            var result = _validator.TestValidate(command);

            result.ShouldHaveValidationErrorFor(ticket => ticket.Title);
            result.ShouldHaveValidationErrorFor(ticket => ticket.Description);
            result.ShouldHaveValidationErrorFor(ticket => ticket.BugType);
            result.ShouldHaveValidationErrorFor(ticket => ticket.Priority);
            result.ShouldHaveValidationErrorFor(ticket => ticket.Device);
        }