Example #1
0
        public void GivenCommandAs_leave_1_Then_Get_1()
        {
            //Given: command as 'leave 1'
            string command = "leave 1";
            //When: I call SlotToEmpty object
            int result = _slotToEmpty.GetNumber(command);

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

            try
            {
                int slotNumber = _slotToEmpty.GetNumber(command);
                message = _validateSlotNumberToEmpty.ValidateSlotNumber(slotNumber);
                if (string.IsNullOrEmpty(message))
                {
                    _parkingRepository.EmptyASlot(slotNumber);
                    message = _leaveSuccessMessage.CreateMessage(slotNumber);
                }
                return(message);
            }
            catch (Exception ex)
            {
                throw;
            }
        }