public void Process_OrderIsNotShipped_ShouldSetTheShipmentPropertyOfTheOrder() { var orderProcessor = new OrderProcessor(new FakeShippingCalculator()); var order = new Order(); orderProcessor.Process(order); Assert.IsTrue(order.IsShipped); Assert.AreEqual(1, order.Shipment.Cost); Assert.AreEqual(DateTime.Today.AddDays(1), order.Shipment.ShippingDate); }
public void Process_OrderNotShipped_SetTheShipmentProperty() { var orderProcessor = new OrderProcessor(new FakeShippingCalculator()); var order = new Order(); // Shipment property is not initialized orderProcessor.Process(order); // calling Process initializes the Shipment property // so we should assert that the order is now shipped Assert.IsTrue(order.isShipped); // Assert.AreEqual(Expected, Actual) // FakeShippingCalculator returns 1 // so the shipment cost of the order should be equal to 1 Assert.AreEqual(1, order.Shipment.Cost); // and the shipping date should be tomorrow Assert.AreEqual(DateTime.Now.AddDays(1).Day, order.Shipment.ShippingDate.Day); }