Ejemplo n.º 1
0
        public void InsertTruck_DuplicateTruck_ShouldNotInsertTheTruck()
        {
            var truck = new Truck("CA1011AH", "John Smith", 1);
            this.park.InsertTruck(truck, 1, 1, new DateTime(2015, 5, 10, 10, 30, 0));

            var truck2 = new Truck("CA1011AH", "Sarah Smith", 1);
            var message = this.park.InsertTruck(truck2, 1, 2, new DateTime(2015, 5, 10, 10, 30, 0));
            Assert.AreEqual("There is already a vehicle with license plate CA1011AH in the park", message);
        }
Ejemplo n.º 2
0
        public void InsertTruck_DuplicatePlace_ShouldNotInsertTheTruck()
        {
            var truck = new Truck("CA1011AH", "John Smith", 1);
            this.park.InsertTruck(truck, 1, 1, new DateTime(2015, 5, 10, 10, 30, 0));

            var truck2 = new Truck("CA1010AH", "Sarah Smith", 1);
            var message = this.park.InsertTruck(truck2, 1, 1, new DateTime(2015, 5, 10, 10, 30, 0));
            Assert.AreEqual("The place (1,1) is occupied", message);
        }
Ejemplo n.º 3
0
        public void InsertTruck_CorrectParameters_ShouldInsertTheTruck()
        {
            var truck = new Truck("CA1011AH", "John Smith", 1);
            var message = this.park.InsertTruck(truck, 1, 1, new DateTime(2015, 5, 10, 10, 30, 0));
            Assert.AreEqual("Truck parked successfully at place (1,1)", message);

            var truck2 = new Truck("CA1010AH", "Sarah Smith", 1);
            message = this.park.InsertTruck(truck2, 1, 2, new DateTime(2015, 5, 10, 10, 30, 0));
            Assert.AreEqual("Truck parked successfully at place (1,2)", message);
        }
Ejemplo n.º 4
0
        public void InitializeTest()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            this.park = new VehiclePark(2, 2);
            var car = new Car("CA1011AH", "John Smith", 1);
            this.park.InsertCar(car, 1, 1, new DateTime(2015, 5, 10, 10, 30, 0));

            var truck = new Truck("CA1010AH", "Sarah Smith", 1);
            this.park.InsertTruck(truck, 1, 2, new DateTime(2015, 5, 10, 10, 30, 0));

            var motorbike = new Motorbike("CA1012AH", "Linda Smith", 1);
            this.park.InsertMotorbike(motorbike, 2, 1, new DateTime(2015, 5, 10, 10, 30, 0));

            var car2 = new Car("CA1013AH", "Linda Cloe", 1);
            this.park.InsertCar(car2, 2, 2, new DateTime(2015, 5, 10, 10, 30, 0));
        }
Ejemplo n.º 5
0
 public void InsertTruck_WrongSector_ShouldNotInsertTheTruck()
 {
     var truck = new Truck("CA1011AH", "John Smith", 1);
     var message = this.park.InsertTruck(truck, 3, 1, new DateTime(2015, 5, 10, 10, 30, 0));
     Assert.AreEqual("There is no sector 3 in the park", message);
 }
Ejemplo n.º 6
0
 public string InsertTruck(Truck truck, int numberOfSector, int placesInSector, DateTime startTime)
 {
     return this.InsertVehicle(truck, numberOfSector, placesInSector, startTime);
 }