public void ExecutePlaceCommandSuccessfulTest() { var subject = new RoboControlCenter(_roboman, _commandResult); string[] commandStringInput = { AppTestConstants.PlaceCommandString, AppTestConstants.ValidPlaceCommandStringArgument }; var expectedActionResult = new MovementActionResult(MovementStatus.RobotPlacementSuccessful); _roboman.SetPositionOnBoard(Arg.Any <int>(), Arg.Any <int>(), Arg.Any <FaceDirection>()).ReturnsForAnyArgs(expectedActionResult); _controlCenter.ExecuteCommand(commandStringInput); // Assert IRobot _roboman.DidNotReceive().Move(); _roboman.DidNotReceive().Left(); _roboman.DidNotReceive().Right(); _roboman.DidNotReceive().ReportStatus(); // Assert roboman is the same with given command string // _roboman.Received().SetPositionOnBoard(1, 1, FaceDirection.NORTH); // Assert ICommandResult was called with the proper actionResult _commandResult.Received().ProcessResult(expectedActionResult); }
public void ExecuteInvalidPlaceYAxisCommandSuccessfulTest() { var subject = new RoboControlCenter(_roboman, _commandResult); string[] commandStringInput = { "place", "1,B,DOWNTOWN" }; _controlCenter.ExecuteCommand(commandStringInput); // Assert IRobot _roboman.DidNotReceive().Move(); _roboman.DidNotReceive().Left(); _roboman.DidNotReceive().Right(); _roboman.DidNotReceive().ReportStatus(); // Assert roboman is the same with given command string // _roboman.DidNotReceive().SetPositionOnBoard(Arg.Any <int>(), Arg.Any <int>(), Arg.Any <FaceDirection>()); // Assert ICommandResult was called with the proper actionResult _commandResult.Received().ProcessResult(Arg.Is <MovementActionResult>(x => x.Status == MovementStatus.RobotPlaceInvalidCommandParsed)); }
public void ExecuteRightCommandSuccessfulTest() { var subject = new RoboControlCenter(_roboman, _commandResult); string[] commandStringInput = { AppTestConstants.RightCommandString }; var expectedActionResult = new MovementActionResult(MovementStatus.TurnRightSuccessful); _roboman.Right().Returns(expectedActionResult); _controlCenter.ExecuteCommand(commandStringInput); // Assert IRobot _roboman.DidNotReceive().Move(); _roboman.DidNotReceive().Left(); _roboman.Received().Right(); _roboman.DidNotReceive().ReportStatus(); // Assert ICommandResult was called with the proper actionResult _commandResult.Received().ProcessResult(expectedActionResult); }