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

            var result = _validator.TestValidate(command);

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