Exemplo n.º 1
0
        public void WhenOperatorCriteriaAreMet_ThenShippingOperatorIsSelected(string targetCountry, decimal weight, string expectedOperator)
        {
            var order = new OrderBuilder()
                        .WithCountry(targetCountry)
                        .WithWeight(weight)
                        .Build();

            var shipmentOperator = ShipmentOperator.Parse(order);

            Assert.AreEqual(expectedOperator, shipmentOperator.Operator);
        }
 private IEnumerable <Shipment> ProcessOrders(IEnumerable <Order> orders)
 {
     foreach (var order in orders)
     {
         var shipmentOperator = ShipmentOperator.Parse(order);
         yield return(new Shipment
         {
             CustomerId = order.CustomerId,
             Name = order.Name,
             Shipper = shipmentOperator.Operator,
             Duration = shipmentOperator.GetShipmentDuration(order),
             ShippingCost = shipmentOperator.GetShipmentPrice(order)
         });
     }
 }