예제 #1
0
        public void FleetTest()
        {
            IDeliveryVehicle deliveryBike  = new DeliveryBike();
            IDeliveryVehicle deliveryCar   = new DeliveryCar();
            IDeliveryVehicle deliveryVan   = new DeliveryVan();
            IDeliveryVehicle deliveryTruck = new DeliveryTruck();

            Fleet fleetOfVehicles = new Fleet();

            fleetOfVehicles.Add(deliveryBike);
            fleetOfVehicles.Add(deliveryCar);
            fleetOfVehicles.Add(deliveryVan);
            fleetOfVehicles.Add(deliveryTruck);

            StringWriter writer = beginReading(); // begin console capture

            MakeDelivery(fleetOfVehicles);
            List <String> consoleEntries = endReading(writer); // end console capture

            var expectedList = new List <string>(new []
            {
                "Bike makes a delivery",
                "Car makes a delivery",
                "Van makes a delivery",
                "Truck makes a delivery"
            });

            Assert.AreEqual(consoleEntries.Count, 4, "Delivery count does not match expected deliveries");
            CollectionAssert.AreEqual(consoleEntries, expectedList, "Deliveries don't match expected deliveries");
        }
예제 #2
0
 public void BuyFlour()
 {
     if (money >= flourPrice)
     {
         DeliveryVan van = Instantiate(deliveryVanPrefab, new Vector3(12, 0, 0), Quaternion.identity).GetComponent <DeliveryVan>();
         van.stapel = flourSupply;
         money     -= flourPrice;
         SpendMoney(flourPrice);
     }
 }
예제 #3
0
 public void BuyTomatoes()
 {
     if (money >= tomatoesPrice)
     {
         DeliveryVan van = Instantiate(deliveryVanPrefab, new Vector3(12, 0, 0), Quaternion.identity).GetComponent <DeliveryVan>();
         van.stapel = tomatoesSupply;
         money     -= tomatoesPrice;
         SpendMoney(tomatoesPrice);
     }
 }
예제 #4
0
 public void BuyPizzaKarton()
 {
     if (money >= pizzakartonPrice)
     {
         DeliveryVan van = Instantiate(deliveryVanPrefab, new Vector3(12, 0, 0), Quaternion.identity).GetComponent <DeliveryVan>();
         van.stapel = pizzaKartonSupply;
         money     -= pizzakartonPrice;
         SpendMoney(pizzakartonPrice);
     }
 }