public void Registering_valid_customer_happy_path_works() { // 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_NoError_Handling("test"); // Assert result.Should() .BeEquivalentTo(RegistrationResponse.Success(customer)); }
public void Registering_valid_customer_happy_path_works() { // Arrange var sut = new RegistrationService(_customerRepository, _mailService); // Act var result = sut.RegisterNewCustomer_Error_Handling2("valid"); // Assert result.Should() .BeEquivalentTo(RegistrationResponse.Success(_customer)); }