public void UnParkedVehicleShouldUpdateTheParkedVehicleStatus()
        {
            var         parkingLot = new ParkingLotCore(LayoutHelper.Layout, new ParkingSpaceMapper());
            ParkingSpot spot       = new ParkingSpot {
                Floor = 1, Row = 1, ParkingSpotTypes = ParkingSpotTypes.Hatchback, StartPosition = 3, SpotCount = 2
            };
            ParkingSpot newVacant = new ParkingSpot {
                Floor = 1, Row = 1, ParkingSpotTypes = ParkingSpotTypes.Hatchback, StartPosition = 5, SpotCount = 6
            };
            ParkingSpot newVacant2 = new ParkingSpot {
                Floor = 1, Row = 1, ParkingSpotTypes = ParkingSpotTypes.Hatchback, StartPosition = 1, SpotCount = 2
            };
            ParkingSpot newVacant3 = new ParkingSpot {
                Floor = 1, Row = 1, ParkingSpotTypes = ParkingSpotTypes.Hatchback, StartPosition = 1, SpotCount = 10
            };
            var vehicle = new Vehicle()
            {
                RegistrationNumber = "XYZABC", VehicleType = VehicleTypes.HatchbackCar
            };

            parkingLot.ParkedVehicle(vehicle, spot).Should().BeTrue();
            parkingLot.UnParkedVehicle(vehicle);
            parkingLot.GetParkingSpotStatus(newVacant).Should().Be(ParkingSpotStatus.Vacant);
            parkingLot.GetParkingSpotStatus(newVacant2).Should().Be(ParkingSpotStatus.Vacant);
            parkingLot.GetParkingSpotStatus(spot).Should().Be(ParkingSpotStatus.Vacant);
            parkingLot.GetParkingSpotStatus(newVacant3).Should().Be(ParkingSpotStatus.Vacant);
        }
Ejemplo n.º 2
0
        public void UnParkVehicleShouldUpdateTheParkedVehicleStatus()
        {
            var         parkingLot = new ParkingLotCore(layout, new ParkingSpaceMapper());
            ParkingSpot spot       = new ParkingSpot {
                Floor = 1, Row = 1, ParkingSpotTypes = ParkingSpotTypes.Motorcycle, StartPosition = 3, SpotCount = 2
            };
            ParkingSpot newVacant = new ParkingSpot {
                Floor = 1, Row = 1, ParkingSpotTypes = ParkingSpotTypes.Motorcycle, StartPosition = 5, SpotCount = 6
            };
            ParkingSpot newVacant2 = new ParkingSpot {
                Floor = 1, Row = 1, ParkingSpotTypes = ParkingSpotTypes.Motorcycle, StartPosition = 1, SpotCount = 2
            };
            ParkingSpot newVacant3 = new ParkingSpot {
                Floor = 1, Row = 1, ParkingSpotTypes = ParkingSpotTypes.Motorcycle, StartPosition = 1, SpotCount = 10
            };
            var vehicle = new Vehicle()
            {
                VehicleNumber = "est", vehicleType = VehicleTypes.MotorCycle
            };

            parkingLot.ParkVehicle(vehicle, spot).Should().BeTrue();
            parkingLot.UnParkvehicle(vehicle);
            parkingLot.GetParkingSpotStatus(newVacant).Should().Be(ParkingSpotStatus.Vacant);
            parkingLot.GetParkingSpotStatus(newVacant2).Should().Be(ParkingSpotStatus.Vacant);
            parkingLot.GetParkingSpotStatus(spot).Should().Be(ParkingSpotStatus.Vacant);
            parkingLot.GetParkingSpotStatus(newVacant3).Should().Be(ParkingSpotStatus.Vacant);
        }
        public void GetParkingStatusShouldReturnVacant()
        {
            var         parkingLot = new ParkingLotCore(LayoutHelper.Layout, new ParkingSpaceMapper());
            ParkingSpot spot       = new ParkingSpot {
                Floor = 1, Row = 3, ParkingSpotTypes = ParkingSpotTypes.Hatchback, StartPosition = 1, SpotCount = 2
            };
            var result = parkingLot.GetParkingSpotStatus(spot);

            result.Should().Be(ParkingSpotStatus.Vacant);
        }