public void TestCommandTurnExecuteValidateParameters() { Robot robot = new Robot(2); var command = new TurnCommand(true); command.Execute(robot, "A,B,C"); }
public void Execute_ShouldInvokeTurnOnRobot() { IProgramCommand command = new TurnCommand(90); var robotMock = new Mock <IRobot>(); command.Execute(robotMock.Object); robotMock.Verify(x => x.Turn(90), Times.Once); }
private void AddTurnCommand(int facingDirection) { if (CanTurn(facingDirection)) { TurnCommand command = new TurnCommand(gameObject, facingDirection, (int)m_FacingDirection); command.Execute(); CommandStackProxy.Get().PushCommand(command); } }
public void Execute_CallsCorrectMethod() { const double TurnAngle = -2.75D; var robotMock = new Mock <IRobot>(); var turnCommand = new TurnCommand(robotMock.Object, TurnAngle); turnCommand.Execute(); robotMock.Verify(c => c.Turn(It.Is <double>(d => d == TurnAngle)), Times.Once()); }
public void TestCommandTurnExecuteAntiClockwise() { Robot robot = new Robot(2); robot.SetPosition(1, 1); robot.SetBearing("NORTH"); var command = new TurnCommand(false); command.Execute(robot, ""); Assert.AreEqual(1, robot.xPos); Assert.AreEqual(1, robot.yPos); Assert.AreEqual("WEST", robot.bearing); }