コード例 #1
0
        public void GivenShortUsername_WhenValidateRegister_ThenReturnValidationErrors()
        {
            var command = RegisterConsultantCommandFactory.RegisterConsultantCommandWithShortUsername();

            var result = _validator.TestValidate(command);

            result.IsValid.Should().BeFalse();
            result.ShouldHaveAnyValidationError();
            result.ShouldHaveValidationErrorFor(c => c.Username)
            .WithErrorMessage(ValidationErrors.ShortUsername);
            result.ShouldNotHaveValidationErrorFor(user => user.Email);
            result.ShouldNotHaveValidationErrorFor(user => user.Location);
            result.ShouldNotHaveValidationErrorFor(user => user.Password);
        }