public void Handle(string input, ParkingLotManager parkingLotManager)
        {
            var tokens = input.Split(' ');

            if (tokens.Length == 2)
            {
                var registrationsByColor = parkingLotManager.GetRegistrationNumbersByCarColor(tokens[1]);
                Console.WriteLine(registrationsByColor.Any() ? string.Join(", ", registrationsByColor) : "Not found");
            }
        }
Ejemplo n.º 2
0
        public void GetRegistrationNumbersByCarColor_Returns_Registration_After_Parking_A_Car()
        {
            var parkingLotManager = new ParkingLotManager();

            parkingLotManager.SetEmptyLots(3);
            var car = new Car {
                RegistrationNumber = "Test-Registration-Number", Color = "Test-Color"
            };

            parkingLotManager.ParkCar(car, 1);

            Assert.Equal(car.RegistrationNumber, parkingLotManager.GetRegistrationNumbersByCarColor("Test-Color").First());
        }
Ejemplo n.º 3
0
        public void GetRegistrationNumbersByCarColor_Returns_Empty_Registration_After_Leaving_Parking()
        {
            var parkingLotManager = new ParkingLotManager();

            parkingLotManager.SetEmptyLots(3);
            var car1 = new Car {
                RegistrationNumber = "Test-Registration-Number1", Color = "Test-Color"
            };

            parkingLotManager.ParkCar(car1, 1);
            parkingLotManager.LeaveParking(1);

            Assert.Empty(parkingLotManager.GetRegistrationNumbersByCarColor("Test-Color"));
        }
Ejemplo n.º 4
0
        public void GetRegistrationNumbersByCarColor_Returns_Registrations_After_Parking_Multiple_Car()
        {
            var parkingLotManager = new ParkingLotManager();

            parkingLotManager.SetEmptyLots(3);
            var car1 = new Car {
                RegistrationNumber = "Test-Registration-Number1", Color = "Test-Color"
            };
            var car2 = new Car {
                RegistrationNumber = "Test-Registration-Number2", Color = "Test-Color"
            };
            var car3 = new Car {
                RegistrationNumber = "Test-Registration-Number3", Color = "Test-Color"
            };

            parkingLotManager.ParkCar(car1, 1);
            parkingLotManager.ParkCar(car2, 1);
            parkingLotManager.ParkCar(car3, 1);

            Assert.Equal(new List <string> {
                car1.RegistrationNumber, car2.RegistrationNumber, car3.RegistrationNumber
            }, parkingLotManager.GetRegistrationNumbersByCarColor("Test-Color"));
        }