public void Should_have_throw_exception_when_order_exist(int customerId, int orderId) { var order = new Order { OrderId = orderId, Amount = 100d }; var orderService = new OrderService(MockCustomerOrderData.GetCustomerService_GetById_Return_Customer(customerId), calculationService, MockCustomerOrderData.GetOrderRepository_OrderExists(true)); Assert.Throws <ArgumentException>( () => orderService.PlaceOrder(order, customerId)); }
public void Should_PlaceOrder(int customerId, int orderId, bool expected) { var order = new Order { OrderId = orderId, Amount = 100d }; var orderService = new OrderService(MockCustomerOrderData.GetCustomerService_GetById_Return_Customer(customerId), calculationService, MockCustomerOrderData.GetOrderRepository_OrderExists(false)); var isOrderPlaced = orderService.PlaceOrder(order, customerId); Assert.AreEqual(expected, isOrderPlaced); }