public void InterpretCommand_WhenGivenACommand_ShouldInterpretItUsingTheInterpreter() { // Arrange var command = new CommandViewModel {Line = "create new task go to the doctor"}; var tasksController = GetTaskController(); // Act tasksController.InterpretCommand(command); // Assert interpreter.Verify(x => x.Interpret(command.Line)); }
public void InterpretCommand_WhenGivenACommandAndInterpretingIt_ShouldReturnJsonSerializedCommandResultOfTheInterpretation() { // Arrange var command = new CommandViewModel { Line = "create new task go to the doctor" }; var resultCommand = new Command { Line = "create new task go to the doctor", Verb = "create new task", Argument = "go to the doctor", Response = "new task created!" }; var tasksController = GetTaskController(); interpreter.Setup(i => i.Interpret(command.Line)).Returns(resultCommand); // Act var jsonResult = tasksController.InterpretCommand(command); // Assert Assert.AreEqual(expected: resultCommand, actual: jsonResult.Data); }
public JsonResult InterpretCommand(CommandViewModel command) { Command resultCommand = interpreter.Interpret(command.Line); return Json(resultCommand); }