public ShippingResult ShipOrder(Customer customer, Order order, Destination destination) { //can only ship via ground to the customer's own address if (new GroundShippingApprovalRule(destination).IsSatisfiedBy(customer)) //do something here with customer, order, and destination return ShippingResult.Success; else return ShippingResult.Failure; }
public ShippingResult ShipOrder(Customer customer, Order order, Destination destination) { //can only ship via air if not in a too-nearby state if (new AirShippingApprovalRule(destination).IsSatisfiedBy(customer)) //do something here with customer, order, and destination return ShippingResult.Success; else return ShippingResult.Failure; }
public void ShipOrder_Can_Return_Success() { Customer customer = new Customer(); Order order = new Order(); Destination destination = new Destination("123", "Main Street", "Anywhere", new State("SomeState", "SS"), "12345"); customer.ChangeAddress(destination); IShipOrders groundShipper = new GroundShipper(); Assert.That(groundShipper.ShipOrder(customer, order, destination), Is.EqualTo(ShippingResult.Success)); }