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

            var result = _validator.TestValidate(command);

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