Ejemplo n.º 1
0
 public void SetDepartureTime(TravelTime timeOfDeparture)
 {
     if (timeOfDeparture != null)
     {
         _departureTime = timeOfDeparture;
     }
 }
Ejemplo n.º 2
0
        public void TestCalculateTravelTime()
        {
            Vehicle    myVehicle   = new Vehicle(35);
            TravelTime packageTime = new TravelTime(16, 45, 56);

            _testDelivery = new Delivery(packageTime, myVehicle);

            double travelTime = _testDelivery.CalculateTravelTime(60);

            Assert.AreEqual(18.48, travelTime);
        }
Ejemplo n.º 3
0
        public void TestCreateUniqueIds()
        {
            Vehicle    myVehicle1   = new Vehicle(25);
            TravelTime packageTime1 = new TravelTime(4, 30, 25);
            Delivery   firstPackage = new Delivery(packageTime1, myVehicle1);

            Vehicle    myVehicle2    = new Vehicle(50);
            TravelTime packageTime2  = new TravelTime(6, 0, 4);
            Delivery   secondpackage = new Delivery(packageTime2, myVehicle2);

            Assert.AreNotEqual(firstPackage.UniqueTrackingNumber, secondpackage.UniqueTrackingNumber);
        }
Ejemplo n.º 4
0
        public void TestSetDepartureTime()
        {
            int seconds = 15;
            int minutes = 15;
            int hours   = 5;

            TravelTime departTime = new TravelTime(hours, minutes, seconds);

            _testDelivery.SetDepartureTime(departTime);

            Assert.AreEqual(_testDelivery.DepartureTime, departTime);
        }
Ejemplo n.º 5
0
        public static List <Delivery> CreateDelivery(int numberOfDelivery, List <Vehicle> vehicleList)
        {
            List <Delivery> packageList = new List <Delivery>();

            for (int count = 0; count < numberOfDelivery; count++)
            {
                int vehicleIndex = count % vehicleList.Count == 0 ? 0 : 1;

                TravelTime newDepartTime = new TravelTime(count + 10 + vehicleIndex,
                                                          count + 10 + vehicleIndex * 2, count + 10 + vehicleIndex * 3);

                Delivery newDelivery = new Delivery(newDepartTime, vehicleList[vehicleIndex]);
                packageList.Add(newDelivery);
            }

            return(packageList);
        }
Ejemplo n.º 6
0
 public Delivery(TravelTime departureTime, Vehicle vehicle)
 {
     _departureTime = departureTime;
     CreateUniqueTrackingNumber();
     _deliveryVehicle = vehicle;
 }
Ejemplo n.º 7
0
 public Delivery()
 {
     _departureTime        = new TravelTime(0, 0, 0);
     _uniqueTrackingNumber = string.Empty;
     _deliveryVehicle      = new Vehicle(25);
 }