public void Should_expect_email_with_valid_format() { // Arrange var validator = new RegisterUserCommandValidator(); var command = new RegisterUserCommand("wrongEmail.com", "P@ssw0rd"); // Act var validationResult = validator.Validate(command); // Assert validationResult.Errors.Should().ContainSingle().Which.ErrorMessage.Should().Be("An email with a correct format is required."); }
public void Should_not_allow_null_password() { // Arrange var validator = new RegisterUserCommandValidator(); var command = new RegisterUserCommand("*****@*****.**", null); // Act var validationResult = validator.Validate(command); // Assert validationResult.Errors.Should().ContainSingle().Which.ErrorMessage.Should().Be("A password is required."); }
public void Should_not_allow_null_email() { // Arrange var validator = new RegisterUserCommandValidator(); var command = new RegisterUserCommand(null, "P@ssw0rd"); // Act var validationResult = validator.Validate(command); // Assert validationResult.Errors.Should().ContainSingle().Which.ErrorMessage.Should().Be("An email is required."); }