public string ExecuteCommand(string command) { string message = string.Empty; try { int allocableSize = _slot.GetSlotSize(command); if (allocableSize > 0) { bool isCreated = _checkParkingLotCreated.IsCreated(); if (!isCreated) { _parkingRepository.CreateParkingSlots(allocableSize); message = "Created a parking lot with " + allocableSize + " slots"; } else { message = "Parking lot alread created"; } } else { message = "Invalid slot size"; } return(message); } catch (Exception ex) { throw; } }
public void GivenCommandAs_create_parking_lot_1_Then_Get_1() { //Given: command as "create_parking_lot 1" string command = "create_parking_lot 1"; //When: I call Slot object int result = _slot.GetSlotSize(command); //Then: get 1 Assert.AreEqual(1, result); }