コード例 #1
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);
        }
コード例 #2
0
        public void TestParkCarMethodShouldThrowExcetionIfParkSpotIsInvalid()
        {
            SoftPark softPark = new SoftPark();
            Car      car      = new Car("Audi", "123123");

            Assert.Throws <ArgumentException>(() => softPark.ParkCar("1", car));
        }
コード例 #3
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!");
        }
コード例 #4
0
        public void TestIfConstructorWorksCorrectly()
        {
            SoftPark park          = new SoftPark();
            int      expectedCount = 12;

            Assert.AreEqual(expectedCount, park.Parking.Count);
        }
コード例 #5
0
        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)));
        }
コード例 #6
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!");
        }
コード例 #7
0
        public void Remove_Car_Throws_Parked_Car_Doesnt_Exist_Exception()
        {
            Car car      = new Car("Audi", "A8");
            var softPark = new SoftPark();

            Assert.Throws <ArgumentException>(() => softPark.RemoveCar("C3", car));
        }
コード例 #8
0
        public void ParkCarThrowsArgumentExceptionIfParkingSpotDoesNotExist()
        {
            SoftPark softPark = new SoftPark();
            Car      car      = new Car("a", "123");

            Assert.That(() => softPark.ParkCar("a", car), Throws.ArgumentException);
        }
コード例 #9
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!");
        }
コード例 #10
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));
        }
コード例 #11
0
        public void SoftParkConstructorWorksProperly()
        {
            SoftPark softPark         = new SoftPark();
            int      expectedCarCount = 12;

            Assert.That(softPark.Parking.Count, Is.EqualTo(expectedCarCount), "SoftPark constructor made too many or not enough cars.");
        }
コード例 #12
0
        public void Test4()
        {
            SoftPark softPark = new SoftPark();

            Assert.Throws <ArgumentException>(
                () => softPark.RemoveCar("G1", new Car("vw", "1234")));
        }
コード例 #13
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);
        }
コード例 #14
0
        public void TestIfNonExistingSpotThrowsException()
        {
            SoftPark softPark = new SoftPark();

            Assert.Throws <ArgumentException>(
                () => softPark.ParkCar("G1", null));
        }
コード例 #15
0
        public void Constructor_Work_Correctly()
        {
            var park = new SoftPark();

            var actualCount = park.Parking.Count;

            Assert.AreEqual(12, actualCount);
        }
コード例 #16
0
ファイル: SoftParkTest.cs プロジェクト: hristopetkovv/SoftUni
        public void TestRemoveCarMethodShouldThrowsException()
        {
            Car car = new Car("Audi", "8596");

            SoftPark softpark = new SoftPark();

            Assert.Throws <ArgumentException>(() => softpark.RemoveCar("Volkswagen", car));
        }
コード例 #17
0
        public void TestIfParkedCarreturnMessageWithRegistrationNum()
        {
            var    softPark = new SoftPark();
            string parkSpot = "C4";
            Car    car      = new Car("MyCar", "123456");

            Assert.AreEqual(softPark.ParkCar(parkSpot, car), $"Car:123456 parked successfully!");
        }
コード例 #18
0
        public void TestCollectionCount()
        {
            SoftPark softPark     = new SoftPark();
            int      parkingCount = softPark.Parking.Count;
            int      count        = 12;

            Assert.AreEqual(count, parkingCount);
        }
コード例 #19
0
        public void TestRemovingACarFromNonexistantSpot()
        {
            SoftPark parking = new SoftPark();
            Car      car     = new Car("VW", "CA2249PC");


            Assert.Throws <ArgumentException>(() => parking.RemoveCar("A15", car), "Parking spot doesn't exists!");
        }
コード例 #20
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!");
        }
コード例 #21
0
        public void TestWhenParkingSpotDoesntExit()
        {
            var    softPark = new SoftPark();
            string parkSpot = "C5";
            Car    car      = new Car("MyCar", "123456");

            Assert.Throws <ArgumentException>(() => softPark.RemoveCar(parkSpot, car));
        }
コード例 #22
0
        public void Parking_Count_Works_Correctly()
        {
            var softPark = new SoftPark();
            var expected = 12;
            var actual   = softPark.Parking.Count;

            Assert.AreEqual(expected, actual);
        }
コード例 #23
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));
        }
コード例 #24
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")));
        }
コード例 #25
0
        public void Test3()
        {
            SoftPark softPark = new SoftPark();
            Car      car      = new Car("vw", "1234");
            string   expected = $"Car:{car.RegistrationNumber} parked successfully!";
            string   actual   = softPark.ParkCar("A1", car);

            Assert.AreEqual(expected, actual);
        }
コード例 #26
0
        public void Park_Car_Work_Correctly()
        {
            var park = new SoftPark();
            Car car  = new Car("Ford", "CA 8484");

            var result = park.ParkCar("A1", car);

            Assert.AreEqual("Car:CA 8484 parked successfully!", result);
        }
コード例 #27
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));
        }
コード例 #28
0
        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));
        }
コード例 #29
0
        public void ParkCarShouldThrowExceptionWithInvalidCarSpot()
        {
            var car = new Car("BMW", "2215");

            var parking = new SoftPark();

            Assert.Throws <ArgumentException>(()
                                              => parking.ParkCar("z11", car));
        }
コード例 #30
0
        public void Remove_Invalid_Car_From_Spot_Throw()
        {
            var park = new SoftPark();
            Car car  = new Car("Ford", "CA 8484");

            park.ParkCar("A1", car);

            Assert.Throws <ArgumentException>(() => park.RemoveCar("A2", car));
        }