Beispiel #1
0
        public void OneCarParkedAt1stSlotAndGivenTheRegistrationNumberThenGetSlotAs1()
        {
            //Given:
            VehicleDetailsModel[] vehicleDetails = new VehicleDetailsModel[1];
            vehicleDetails[0] = new VehicleDetailsModel
            {
                RegistrationNumber = "ka-01-hh-1111",
                Color = "green"
            };
            string registrationNumber = "ka-01-hh-1111";
            //When: I call SlotByRegistrationNumber object
            int result = _slotByRegistrationNumber.GetSlotNumber(vehicleDetails, registrationNumber);

            //Then: I get 1
            Assert.AreEqual(1, result);
        }
        public string ExecuteCommand(string command)
        {
            string message = string.Empty;

            try
            {
                string registrationNumber            = _vehicleRegistrationNumber.GetNumber(command);
                VehicleDetailsModel[] vehicleDetails = _parkingRepository.GetParkingDetails();
                int slot = _slotByRegistrationNumber.GetSlotNumber(vehicleDetails, registrationNumber);
                if (slot > 0)
                {
                    message = slot.ToString();
                }
                else
                {
                    message = "Not found";
                }
                return(message);
            }
            catch (Exception ex)
            {
                throw;
            }
        }