Ejemplo n.º 1
0
        public void WhenValidatingInvalidDataAnnotationsValidatableCommandThenReturnsFalse()
        {
            // Assign
            ICommandValidator validator = new DefaultCommandValidator();
            ICommand command = new DataAnnotationsValidatableCommand { Property1 = "01234567890123456789" };
            CommandHandlerRequest request = new CommandHandlerRequest(this.configuration, command);

            // Act
            bool result = validator.Validate(request);

            // Assert
            Assert.False(result);
            Assert.Equal(1, request.ModelState.Count);
        }
Ejemplo n.º 2
0
        public void WhenValidatingInvalidDataAnnotationsValidatableCommandThenReturnsFalse()
        {
            // Assign
            ICommandValidator validator = new DefaultCommandValidator();
            ICommand          command   = new DataAnnotationsValidatableCommand {
                Property1 = "01234567890123456789"
            };
            CommandHandlerRequest request = new CommandHandlerRequest(this.configuration, command);

            // Act
            bool result = validator.Validate(request);

            // Assert
            Assert.False(result);
            Assert.Equal(1, request.ModelState.Count);
        }