public void Should_send_dispatch_email() { var order = new Order(); handler.Handle(new OrderDispatched(order)); emailService.AssertWasCalled(e => e.SendDispatchNotification(order)); }
public void ValidOrder_SendsConfirmationEMailToCustomer() { var order = MakeOrders(); var orderService = new OrderService(_mockIProductRepository, _mockICustomerRepository, _mockIEmailService, _mockIOrderFulfillmentService, _mockITaxRateService); _mockIProductRepository.Stub(a => a.IsInStock("ABCDE")).Return(true); _mockIProductRepository.Stub(a => a.IsInStock("BCDEF")).Return(true); _mockIOrderFulfillmentService.Stub(s => s.Fulfill(order)) .Return(new OrderConfirmation { OrderNumber = "AX1123", CustomerId = 1, OrderId = 7 }); var customer = new Customer { CustomerId = 1, PostalCode = "99999", StateOrProvince = "WA" }; _mockICustomerRepository.Stub(c => c.Get(Arg <int> .Is.Anything)).Return(customer); var orderSummary = orderService.PlaceOrder(order); Assert.IsNotNull(orderSummary); _mockIEmailService.AssertWasCalled(es => es.SendOrderConfirmationEmail(orderSummary.CustomerId, orderSummary.OrderId)); }
public void Should_send_email_confirmation() { var order = new Order(); handler.Handle(new OrderConfirmed(order)); emailService.AssertWasCalled(s => s.SendOrderConfirmation(order)); }
public void PlaceOrder_ValidOrder_EmailConfirmationSent() { // Arrange StubProductRepository(true, SkuConstString); StubGetStandardCustomerFromRepository(); const int orderId = 538; StubFulfillOrder(new OrderConfirmation { OrderId = orderId }); StubTaxRateService(null); // Act _orderService.PlaceOrder(_order); // Assert _mockEmailService.AssertWasCalled(e => e.SendOrderConfirmationEmail(CustomerIdConstInt, orderId)); }
public void Test_Email_Service_Has_Been_Called_Once() { _order = CreateOrderObject(product_sku_1, product_sku_2); _orderService.PlaceOrder(_order); _emailService.AssertWasCalled(e => e.SendOrderConfirmationEmail(customer_id_1, order_id_1), options => options.Repeat.Times(1)); }