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

            var result = _validator.TestValidate(command);

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