Exemple #1
0
        public void RemoveVehicle_IfRemovedVehicleIsRemoved_IsTrue()
        {
            // Assign
            ParkingSlot slot       = new ParkingSlot();
            Bike        bike1      = new Bike("B1");
            Bike        bike2      = new Bike("B2");
            Bike        bike3      = new Bike("B3");
            Bike        bike4      = new Bike("B4");
            bool        actualBool = false;

            // Act
            slot.AddVehicle(bike1);
            slot.AddVehicle(bike2);
            slot.AddVehicle(bike3);
            slot.AddVehicle(bike4);

            slot.RemoveVehicle("B1");

            // Assert
            if (!slot.Content().Contains(bike1) && slot.Content().Contains(bike2))
            {
                actualBool = true;
            }
            Assert.AreEqual(true, actualBool);
        }
Exemple #2
0
        public void ParkingSlotRemoveVehicleCarNotFoundTest()
        {
            // Setup
            string registrationNumber = "abc123";
            string parkingSlot        = "poi654,1999-01-02 13:34";

            // Act
            ParkingSlot.RemoveVehicle(ref parkingSlot, registrationNumber);
        }
Exemple #3
0
        public void ParkingSlotRemoveVehicleCarFoundTest()
        {
            // Setup
            string registrationNumber  = "poi654";
            string parkingSlot         = "poi654,1999-01-02 13:34";
            string expectedParkingSlot = null;

            // Act
            ParkingSlot.RemoveVehicle(ref parkingSlot, registrationNumber);

            // Verify
            Assert.AreEqual(expectedParkingSlot, parkingSlot);
        }
Exemple #4
0
        public void ParkingSlotRemoveVehicleNullTest()
        {
            // Setup
            string registrationNumber  = "abc123";
            string parkingSlot         = null;
            string expectedParkingSlot = null;

            // Act
            ParkingSlot.RemoveVehicle(ref parkingSlot, registrationNumber);

            // Verify
            Assert.AreEqual(expectedParkingSlot, parkingSlot);
        }
Exemple #5
0
        public void ParkingSlotRemoveVehicleLeftTest()
        {
            // Setup
            string registrationNumber  = "lkj987";
            string parkingSlot         = "lkj987:abc123";
            string expectedParkingSlot = ":abc123";

            // Act
            ParkingSlot.RemoveVehicle(ref parkingSlot, registrationNumber);

            // Verify
            Assert.AreEqual(expectedParkingSlot, parkingSlot);
        }
Exemple #6
0
        public void RemoveVehicle_IfRemovedVehicleDoesNotExist_IsTrue()
        {
            // Assign
            ParkingSlot slot  = new ParkingSlot();
            Bike        bike1 = new Bike("B1");
            Bike        bike2 = new Bike("B2");
            Bike        bike3 = new Bike("B3");
            Bike        bike4 = new Bike("B4");

            // Act
            slot.AddVehicle(bike1);
            slot.AddVehicle(bike2);
            slot.AddVehicle(bike3);
            slot.AddVehicle(bike4);

            slot.RemoveVehicle("Reg that does not exist.");

            // Assert

            Assert.AreEqual(4, slot.Content().Count);
        }