public void TestInsertCarWithSameLisencePlateShouldReturnErrorMessage()
        {
            IVehiclePark vehiclePark = new VehiclePark(3, 5);
            var firstVehicle = new Car("CA1001HH", "Jay Margareta", 1);
            var secondVehicle = new Car("CA1001HH", "Guy Sheard", 2);

            vehiclePark.InsertCar(firstVehicle, 1, 5, new DateTime(2015, 05, 04, 10, 30, 00));
            string message = vehiclePark.InsertCar(secondVehicle, 1, 3, new DateTime(2015, 05, 04, 10, 30, 00));

            Assert.AreEqual("There is already a vehicle with license plate CA1001HH in the park", message);
        }
        public void TestInsertCarAtAlreadyOccupiedPlaceInSectorShouldReturnErrorMessage()
        {
            IVehiclePark vehiclePark = new VehiclePark(3, 5);
            var firstVehicle = new Car("CA1001HH", "Jay Margareta", 1);
            var secondVehicle = new Car("CA1111HH", "Guy Sheard", 2);

            vehiclePark.InsertCar(firstVehicle, 1, 5, new DateTime(2015, 05, 04, 10, 30, 00));
            string message = vehiclePark.InsertCar(secondVehicle, 1, 5, new DateTime(2015, 05, 04, 10, 30, 00));

            Assert.AreEqual("The place (1,5) is occupied", message);
        }
        public void TestFullPark()
        {
            IVehiclePark vehiclePark = new VehiclePark(1, 3);
            var firstVehicle = new Car("CA1001HH", "Jay Margareta", 1);
            vehiclePark.InsertCar(firstVehicle, 1, 1, new DateTime(2015, 05, 04, 10, 30, 00));
            var secondVehicle = new Car("CA1111HH", "Guy Sheard", 2);
            vehiclePark.InsertCar(secondVehicle, 1, 2, new DateTime(2015, 05, 04, 10, 40, 00));
            var thirdVehicle = new Truck("C5842CH", "Jessie Raul", 5);
            vehiclePark.InsertTruck(thirdVehicle, 1, 3, new DateTime(2015, 05, 04, 10, 50, 00));
            string message = vehiclePark.GetStatus();

            var result = new StringBuilder();
            result.Append("Sector 1: 3 / 3 (100% full)");

            Assert.AreEqual(result.ToString(), message);
        }
        public void TestInsertOneLegitimateCarShouldReturnASuccessMessage()
        {
            IVehiclePark vehiclePark = new VehiclePark(3, 5);
            var vehicle = new Car("CA1001HH", "Jay Margareta", 1);

            string message = vehiclePark.InsertCar(vehicle, 1, 5, new DateTime(2015, 05, 04, 10, 30, 00));

            Assert.AreEqual("Car parked successfully at place (1,5)", message);
        }
        public void TestInsertCarAtNonExistingSectorShouldReturnErrorMessage()
        {
            IVehiclePark vehiclePark = new VehiclePark(3, 5);
            var vehicle = new Car("CA1001HH", "Jay Margareta", 1);

            string message = vehiclePark.InsertCar(vehicle, 30, 5, new DateTime(2015, 05, 04, 10, 30, 00));

            Assert.AreEqual("There is no sector 30 in the park", message);
        }
        public void TestFindVehicleWithNonExistingOwnerShouldReturnErrorMessage()
        {
            var vehiclePark = new VehiclePark(2, 3);
            var vehicle = new Car("CA1001HH", "Jay Margareta", 1);
            vehiclePark.InsertCar(vehicle, 1, 2, new DateTime(2015, 05, 04, 10, 30, 00));
            string message = vehiclePark.FindVehiclesByOwner("Margarata");

            Assert.AreEqual("No vehicles by Margarata", message);
        }
        public void TestAVehicleExitWithIncorrectLisenceplateShouldReturnAnErrorMessage()
        {
            IVehiclePark vehiclePark = new VehiclePark(3, 5);
            var vehicle = new Car("CA1001HH", "Jay Margareta", 1);

            vehiclePark.InsertCar(vehicle, 1, 5, new DateTime(2015, 05, 04, 10, 30, 00));
            string message = vehiclePark.ExitVehicle("CA1101HH", new DateTime(2015, 05, 04, 13, 30, 00), 40m);

            Assert.AreEqual("There is no vehicle with license plate CA1101HH in the park", message);
        }
        public void TestFindOneVehicleShouldReturnTheVehicleWithTheOwnerAndTheParkingPlace()
        {
            var vehiclePark = new VehiclePark(2, 3);
            var vehicle = new Car("CA1001HH", "Jay Margareta", 1);
            vehiclePark.InsertCar(vehicle, 1, 2, new DateTime(2015, 05, 04, 10, 30, 00));
            string message = vehiclePark.FindVehiclesByOwner("Jay Margareta");

            var result = new StringBuilder();
            result.AppendLine("Car [CA1001HH], owned by Jay Margareta").Append("Parked at (1,2)");

            Assert.AreEqual(result.ToString(), message);
        }
        public void TestAVehicleExitSuccessWithLessThanTheStayingHoursShouldReturnAnExitTicketWithFullHoursPaid()
        {
            IVehiclePark vehiclePark = new VehiclePark(3, 5);
            var vehicle = new Car("CA1001HH", "Jay Margareta", 1);

            vehiclePark.InsertCar(vehicle, 1, 5, new DateTime(2015, 05, 04, 10, 30, 00));
            string message = vehiclePark.ExitVehicle("CA1001HH", new DateTime(2015, 05, 04, 10, 50, 00), 40m);

            var ticket = new StringBuilder();
            ticket.AppendLine("********************")
                .AppendLine("Car [CA1001HH], owned by Jay Margareta")
                .AppendLine("at place (1,5)")
                .AppendLine("Rate: $2.00")
                .AppendLine("Overtime rate: $0.00")
                .AppendLine("--------------------")
                .AppendLine("Total: $2.00")
                .AppendLine("Paid: $40.00")
                .AppendLine("Change: $38.00")
                .Append("********************");

            Assert.AreEqual(ticket.ToString(), message);
        }