static void Main(string[] args) { while (true) { var userInput = Console.ReadLine(); var userInputSplited = userInput.Split(CommonConstants.Whitespace); var command = userInputSplited.First(); var commandFirstParameter = userInputSplited.Length > 1 ? userInputSplited[1] : String.Empty; var commandSecondParameter = userInputSplited.Length > 2 ? userInputSplited[2] : String.Empty; switch (command) { case CliCommands.CreateCommand: var animalType = CommandParser.GetAnimalTypeFromParameter(commandFirstParameter); Lab.Create(animalType, commandSecondParameter); break; case CliCommands.GoToSleepCommand: Lab.GoToSleep(commandFirstParameter); break; case CliCommands.GoEatCommand: Lab.GoEat(commandFirstParameter); break; case CliCommands.BarkerCommand: Lab.Barker(commandFirstParameter); break; case CliCommands.PurrerCommand: Lab.Purrer(commandFirstParameter); break; case CliCommands.SqueakerCommand: Lab.Squeaker(commandFirstParameter); break; case CliCommands.ListCommand: Lab.ListAnimals(); break; case CliCommands.DeleteCommand: Lab.Delete(commandFirstParameter); break; default: Cli.DisplayError("Unknown command"); break; } } }
public void ShouldSendDogToBarkerIfFedAndRested() { //Given StubCommandInterface stubbedCli = new StubCommandInterface(); Laboratory laboratory = new Laboratory(stubbedCli); AnimalTypeEnum testType = AnimalTypeEnum.Dog; string testName = "Rex"; laboratory.Create(AnimalTypeEnum.Dog, testName); laboratory.GoEat(testName); laboratory.GoToSleep(testName); //When laboratory.Barker(testName); //Then Assert.That(stubbedCli.BarksMessages, Does.Contain(testName)); }