public void Registering_invalid_customer_rop_should_have_correct_error()
        {
            // Arrange
            var customer = new Customer(CustomerName.TryCreate("test").Value);

            var customerRepository = Substitute.For <ICustomerRepository>();

            customerRepository
            .Save(Arg.Any <Customer>())
            .Returns(Result.Ok(customer));

            var mailService = Substitute.For <IMailService>();

            mailService
            .SendGreeting(Arg.Any <Customer>())
            .Returns(Result.Ok(customer));

            var sut = new RegistrationService(customerRepository, mailService);

            // Act
            var result = sut.RegisterNewCustomer_Error_Handling2("");

            // Assert
            result.Should()
            .BeEquivalentTo(RegistrationResponse.Fail("invalid name"));
        }
        public void Registering_invalid_customer_should_have_correct_error()
        {
            // Arrange
            var sut = new RegistrationService(_customerRepository, _mailService);

            // Act
            var result = sut.RegisterNewCustomer_Error_Handling2("");

            // Assert
            result.Should()
            .BeEquivalentTo(RegistrationResponse.Fail("invalid name"));
        }
        public void Registering_with_mailer_error_should_have_correct_error()
        {
            // Arrange
            var sut = new RegistrationService(_customerRepository, _mailService);

            _mailService
            .SendGreeting(Arg.Any <Customer>())
            .Returns(Left("mailer error"));

            // Act
            var result = sut.RegisterNewCustomer_Error_Handling2("valid");

            // Assert
            result.Should()
            .BeEquivalentTo(RegistrationResponse.Fail("mailer error"));
        }