Exemple #1
0
        public void CalculateDeliveryCosts_Returns_200()
        {
            //Arrange
            var costCalculator = new EmployeeDeliveryCostCalculator();

            //Act
            var cost = costCalculator.CalculateDeliveryCost(_order);

            //Assert
            Assert.AreEqual(2.00, cost);
        }
        static void Main(string[] args)
        {
            var pizzas = new List <Pizza>
            {
                new Pizza(),
                new Pizza(),
                new Pizza()
            };
            var order = new Order(pizzas);


            //Calculate cost to deliver pizzas by drone
            var droneDeliveryCalculator = new DroneDeliveryCostCalculator();
            var droneDelivery           = new DeliveryCostCalculationService(droneDeliveryCalculator);

            Console.WriteLine(
                $"Cost to deliver {order.Pizzas.Count} pizzas by Drone is: {droneDelivery.CalculateDeliveryCost(order)}");

            //Calculate cost to delivery pizzas by taxi
            var taxiDeliveryCalculator = new TaxiDeliveryCostCalculator();
            var taxiDelivery           = new DeliveryCostCalculationService(taxiDeliveryCalculator);

            Console.WriteLine(
                $"Cost to deliver {order.Pizzas.Count} pizzas by Taxi is: {taxiDelivery.CalculateDeliveryCost(order)}");

            //Calculate cost to deliver pizzas by store employee
            var storeEmployeeDeliveryCalculator = new EmployeeDeliveryCostCalculator();
            var employeeDelivery = new DeliveryCostCalculationService(storeEmployeeDeliveryCalculator);

            Console.WriteLine(
                $"Cost to deliver {order.Pizzas.Count} pizzas by Store Employee is: {employeeDelivery.CalculateDeliveryCost(order)}");

            //Calculate cost to collect pizzas in store by customer
            var customerCollectionDeliveryCalculator = new NoDeliveryCostCalculator();
            var customerCollection = new DeliveryCostCalculationService(customerCollectionDeliveryCalculator);

            Console.WriteLine($"Cost to collect {order.Pizzas.Count} pizzas in store is: {customerCollection.CalculateDeliveryCost(order)}");

            Console.ReadKey();
        }