public void InsertCar_DuplicateCar_ShouldNotInsertTheCar() { var car = new Car("CA1011AH", "John Smith", 1); this.park.InsertCar(car, 1, 1, new DateTime(2015, 5, 10, 10, 30, 0)); var car2 = new Car("CA1011AH", "Sarah Smith", 1); var message = this.park.InsertCar(car2, 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); }
public void InsertCar_DuplicatePlace_ShouldNotInsertTheCar() { var car = new Car("CA1011AH", "John Smith", 1); this.park.InsertCar(car, 1, 1, new DateTime(2015, 5, 10, 10, 30, 0)); var car2 = new Car("CA1010AH", "Sarah Smith", 1); var message = this.park.InsertCar(car2, 1, 1, new DateTime(2015, 5, 10, 10, 30, 0)); Assert.AreEqual("The place (1,1) is occupied", message); }
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)); }
public void InsertCar_CorrectParameters_ShouldInsertTheCar() { var car = new Car("CA1011AH", "John Smith", 1); var message = this.park.InsertCar(car, 1, 1, new DateTime(2015, 5, 10, 10, 30, 0)); Assert.AreEqual("Car parked successfully at place (1,1)", message); var car2 = new Car("CA1010AH", "Sarah Smith", 1); message = this.park.InsertCar(car2, 1, 2, new DateTime(2015, 5, 10, 10, 30, 0)); Assert.AreEqual("Car parked successfully at place (1,2)", message); var car3 = new Car("CA1012AH", "Linda Smith", 1); message = this.park.InsertCar(car3, 2, 1, new DateTime(2015, 5, 10, 10, 30, 0)); Assert.AreEqual("Car parked successfully at place (2,1)", message); var car4 = new Car("CA1013AH", "Linda Cloe", 1); message = this.park.InsertCar(car4, 2, 2, new DateTime(2015, 5, 10, 10, 30, 0)); Assert.AreEqual("Car parked successfully at place (2,2)", message); }
public void InsertCar_WrongSector_ShouldNotInsertTheCar() { var car = new Car("CA1011AH", "John Smith", 1); var message = this.park.InsertCar(car, 3, 1, new DateTime(2015, 5, 10, 10, 30, 0)); Assert.AreEqual("There is no sector 3 in the park", message); }
public string InsertCar(Car car, int numberOfSector, int placesInSector, DateTime startTime) { return this.InsertVehicle(car, numberOfSector, placesInSector, startTime); }