예제 #1
0
        public void ACarWithColorRedParkedAtSlot1_And_Given_Color_As_Red()
        {
            //Given:
            VehicleDetailsModel[] vehicleDetails = new VehicleDetailsModel[1];
            vehicleDetails[0] = new VehicleDetailsModel
            {
                Color = "red",
                RegistrationNumber = "ka-01-hh-1111"
            };
            string color = "red";
            //When: I call SlotByColor object
            List <int> result = _slotByColor.GetSlotNumbers(vehicleDetails, color);

            //Then: I get a list of length 1
            Assert.AreEqual(1, result.Count);
        }
예제 #2
0
        public string ExecuteCommand(string command)
        {
            string message = string.Empty;

            try
            {
                string color = _vehicleColor.GetColor(command);
                VehicleDetailsModel[] vehicleDetails = _parkingRepository.GetParkingDetails();
                List <int>            slotList       = _slotByColor.GetSlotNumbers(vehicleDetails, color);
                if (slotList.Count > 0)
                {
                    message = _slotByColorMessage.BuildMessage(slotList);
                }
                else
                {
                    message = "Not found";
                }
                return(message);
            }
            catch (Exception ex)
            {
                throw;
            }
        }