Пример #1
0
        public void ParkingSpotIsTakenAlready()
        {
            SoftPark park = new SoftPark();

            park.ParkCar("A1", this.car);
            Assert.Throws <ArgumentException>(() => park.ParkCar("A1", new Car("Make", "CA234")), "Parking spot is already taken!");
        }
Пример #2
0
        public void ParkCar_ShouldBeOk()
        {
            Car      car     = new Car("make", "32131");
            Car      car1    = new Car("mazarate", "CB4444BB");
            SoftPark parking = new SoftPark();

            parking.ParkCar("A1", car);
            parking.ParkCar("A2", car1);

            var parked = new Dictionary <string, Car>
            {
                { "A1", car },
                { "A2", car1 },
                { "A3", null },
                { "A4", null },
                { "B1", null },
                { "B2", null },
                { "B3", null },
                { "B4", null },
                { "C1", null },
                { "C2", null },
                { "C3", null },
                { "C4", null },
            };

            Assert.AreEqual(parked, parking.Parking);
        }
Пример #3
0
        public void TestCarIsAlreadyParked()
        {
            SoftPark parking = new SoftPark();

            parking.ParkCar("A1", this.car);
            Assert.Throws <InvalidOperationException>(() => parking.ParkCar("A2", this.car), "Car is already parked!");
        }
Пример #4
0
        public void Test_Park_Car_Throw_Exception_For_Parked_Car()
        {
            Car car      = new Car("Audi", "A8");
            var softPark = new SoftPark();

            softPark.ParkCar("C4", car);

            Assert.Throws <InvalidOperationException>(() => softPark.ParkCar("C3", car));
        }
        public void Car_Is_Already_Parked_Throw()
        {
            var park = new SoftPark();
            Car car  = new Car("Ford", "CA 8484");

            park.ParkCar("A1", car);

            Assert.Throws <InvalidOperationException>(() => park.ParkCar("B1", car));
        }
Пример #6
0
        public void TestParkingTheSameCarAtDifferentPlace()
        {
            SoftPark parking = new SoftPark();
            Car      car     = new Car("VW", "CA2249PC");

            parking.ParkCar("A1", car);

            Assert.Throws <InvalidOperationException>(() => parking.ParkCar("A2", car), "Car is already parked!");
        }
Пример #7
0
        public void ParkCar_ShouldThrowException()
        {
            Car      car     = new Car("make", "32131");
            SoftPark parking = new SoftPark();

            parking.ParkCar("A1", car);

            Assert.Throws <ArgumentException>(() => parking.ParkCar("A1", new Car("make", "321321")));
        }
Пример #8
0
        public void ParkCar_ShouldThrowExceptioneSameCar()
        {
            Car      car     = new Car("make", "32131");
            SoftPark parking = new SoftPark();

            parking.ParkCar("A1", car);

            Assert.Throws <InvalidOperationException>(() => parking.ParkCar("A2", car));
        }
Пример #9
0
        public void ParkingCar_ShouldParkCar()
        {
            string slot = "A1";
            Car    car  = new Car("bmw", "69");

            string actualMessage   = soft.ParkCar(slot, car);
            string expectedMessage = $"Car:{car.RegistrationNumber} parked successfully!";

            Assert.AreEqual(expectedMessage, actualMessage);
        }
        public void TestIfCarIsAlreadyParked()
        {
            SoftPark softPark = new SoftPark();
            Car      car      = new Car("VW", "1234");

            softPark.ParkCar("A1", car);

            Assert.Throws <InvalidOperationException>(
                () => softPark.ParkCar("A2", car));
        }
        public void TestIfParkingSpotIsTaken()
        {
            SoftPark softPark = new SoftPark();
            Car      car      = new Car("Honda", "1234");

            softPark.ParkCar("A1", car);

            Assert.Throws <ArgumentException>(
                () => softPark.ParkCar("A1", car));
        }
Пример #12
0
        public void TestParkingOnAlreadyTakenSpot()
        {
            SoftPark parking = new SoftPark();
            Car      car     = new Car("VW", "CA2249PC");
            Car      newCar  = new Car("VW", "CA0000AC");

            parking.ParkCar("A1", car);

            Assert.Throws <ArgumentException>(() => parking.ParkCar("A1", newCar), "Parking spot is already taken!");
        }
Пример #13
0
        public void ThrowInvalidOperationExceptionWhenTheCarIsAlreadyParked()
        {
            var    softPark = new SoftPark();
            string parkSpot = "C4";
            Car    car      = new Car("MyCar", "123456");

            softPark.ParkCar(parkSpot, car);

            Assert.Throws <InvalidOperationException>(() => softPark.ParkCar("C2", car));
        }
        public void Parking_Spot_Is_Already_Taken_Throw()
        {
            var park      = new SoftPark();
            Car car       = new Car("Ford", "CA 8484");
            Car secondCar = new Car("Opel", "CB 8484");

            park.ParkCar("A1", car);

            Assert.Throws <ArgumentException>(() => park.ParkCar("A1", secondCar));
        }
Пример #15
0
        public void TestParkCarMethodShouldThrowExcetionIfParkSpotIsNotNull()
        {
            SoftPark softPark = new SoftPark();
            Car      car      = new Car("Audi", "123123");
            Car      car2     = new Car("AudiQ", "123123");

            softPark.ParkCar("A1", car);

            Assert.Throws <ArgumentException>(() => softPark.ParkCar("A1", car2));
        }
Пример #16
0
        public void Test_Park_Car_Throw_Exception_For_Taken_Parking_Spot()
        {
            Car car      = new Car("Audi", "A8");
            var softPark = new SoftPark();

            softPark.ParkCar("C4", car);

            Car anotherCar = new Car("BMW", "X6");

            Assert.Throws <ArgumentException>(() => softPark.ParkCar("C4", anotherCar));
        }
Пример #17
0
        public void FUKINGTEST()
        {
            SoftPark softPark = new SoftPark();

            var car = new Car("BMW", "ABC123");

            softPark.ParkCar("A1", car);

            Assert.Throws <InvalidOperationException>(
                () => softPark.ParkCar("B1", car));
        }
Пример #18
0
        public void ThrowArgumentExceptionWhenParkingSpotIsAlreadytaken()
        {
            var    softPark         = new SoftPark();
            string parkSpot         = "C4";
            Car    carAlreadyParked = new Car("MyParkedCar", "1234567");

            softPark.ParkCar(parkSpot, carAlreadyParked);

            Car car = new Car("OtherCar", "1234");

            Assert.Throws <ArgumentException>(() => softPark.ParkCar(parkSpot, car));
        }
Пример #19
0
        public void ParkCarShouldThrowExceptionIfRegistrationNumberIsAlreadyExist()
        {
            var car  = new Car("BMW", "2215");
            var car2 = new Car("Audi", "2215");

            var parking = new SoftPark();

            parking.ParkCar("A1", car);

            Assert.Throws <InvalidOperationException>(()
                                                      => parking.ParkCar("A2", car2));
        }
Пример #20
0
        public void ParkCarShouldThrowExceptionIfCarSpotIsNotEmpty()
        {
            var car  = new Car("BMW", "2215");
            var car2 = new Car("Audi", "5115");

            var parking = new SoftPark();

            parking.ParkCar("A1", car);

            Assert.Throws <ArgumentException>(()
                                              => parking.ParkCar("A1", car2));
        }
Пример #21
0
        public void ParkTheSameCar()
        {
            SoftPark park = new SoftPark();

            Car    car         = new Car("Audi", "1234");
            string parkSpotOne = "A3";
            string parkSpotTwo = "A1";

            park.ParkCar(parkSpotOne, car);

            Assert.Throws <InvalidOperationException>(() =>
            {
                park.ParkCar(parkSpotTwo, car);
            });
        }
Пример #22
0
        public void ParkingSpotAlreadyTaken()
        {
            SoftPark park = new SoftPark();

            Car    carOne   = new Car("Audi", "1234");
            Car    carTwo   = new Car("BMW", "2345");
            string parkSpot = "A3";

            park.ParkCar(parkSpot, carOne);

            Assert.Throws <ArgumentException>(() =>
            {
                park.ParkCar(parkSpot, carTwo);
            });
        }
Пример #23
0
        public void TestIfParkCarCommandWorksCorrectly()
        {
            Car car = new Car("VW", "1157");

            parking.ParkCar("A1", car);

            Assert.NotNull(parking.Parking["A1"]);
        }
Пример #24
0
        public void TestParkingOnNonExistantSpot()
        {
            SoftPark parking = new SoftPark();
            Car      car     = new Car("VW", "CA2249PC");

            Assert.Throws <ArgumentException>(() => parking.ParkCar("A5", car), "Parking spot doesn't exists!");
        }
        public void TestIfNonExistingSpotThrowsException()
        {
            SoftPark softPark = new SoftPark();

            Assert.Throws <ArgumentException>(
                () => softPark.ParkCar("G1", null));
        }
Пример #26
0
        public void RemoveCar_ShouldRemoveCar()
        {
            Car      car     = new Car("maare", "31232");
            SoftPark parking = new SoftPark();

            parking.ParkCar("A1", car);

            parking.RemoveCar("A1", car);

            var parked = new Dictionary <string, Car>
            {
                { "A1", null },
                { "A2", null },
                { "A3", null },
                { "A4", null },
                { "B1", null },
                { "B2", null },
                { "B3", null },
                { "B4", null },
                { "C1", null },
                { "C2", null },
                { "C3", null },
                { "C4", null },
            };

            Assert.AreEqual(parked, parking.Parking);
        }
Пример #27
0
        public void ParkCarThrowsArgumentExceptionIfParkingSpotDoesNotExist()
        {
            SoftPark softPark = new SoftPark();
            Car      car      = new Car("a", "123");

            Assert.That(() => softPark.ParkCar("a", car), Throws.ArgumentException);
        }
        public void Parking_Spot_Doesnt_Exists_Throw()
        {
            var park = new SoftPark();
            Car car  = new Car("Ford", "CA 8484");

            Assert.Throws <ArgumentException>((() => park.ParkCar("A0", car)));
        }
Пример #29
0
        public void Test_Park_Car_Throw_Exception_For_Invalid_Parking_Spot()
        {
            Car car      = new Car("Audi", "A8");
            var softPark = new SoftPark();

            Assert.Throws <ArgumentException>(() => softPark.ParkCar("C5", car));
        }
Пример #30
0
        public void TestRemoveNonExistingCarOnSpot()
        {
            SoftPark softPark = new SoftPark();
            Car      current  = new Car("Bently", "975");

            softPark.ParkCar("A1", new Car("Lada", "293746"));
            Assert.Throws <ArgumentException>(() => softPark.RemoveCar("A1", current), "Car for that spot doesn't exists!");
        }