public void TestExecuteSetsCoordinatesAndDirectionOnPlace() { var robot = Substitute.For <IRobot>(); var o = new Simulator.Executor(robot); o.Execute(CommandType.PLACE, 0, 0, Direction.NORTH); robot.Received(1).X = 0; robot.Received(1).Y = 0; robot.Received(1).FacingDirection = Direction.NORTH; }
public void TestExecuteNotSetDirectionNorCoordinatesOnReport() { var robot = Substitute.For <IRobot>(); robot.X.Returns(0); robot.Y.Returns(0); robot.FacingDirection.Returns(Direction.NORTH); var o = new Simulator.Executor(robot); o.Execute(CommandType.REPORT); robot.DidNotReceive().X = Arg.Any <int>(); robot.DidNotReceive().Y = Arg.Any <int>(); robot.DidNotReceive().FacingDirection = Arg.Any <Direction>(); }
public void TestExecuteSetsDirectionAndNotCoordinatesOnRight() { var robot = Substitute.For <IRobot>(); robot.X.Returns(0); robot.Y.Returns(0); robot.FacingDirection.Returns(Direction.NORTH); var o = new Simulator.Executor(robot); o.Execute(CommandType.RIGHT); robot.DidNotReceive().X = Arg.Any <int>(); robot.DidNotReceive().Y = Arg.Any <int>(); robot.Received(1).FacingDirection = Direction.EAST; }
public void TestExecuteSetsCoordinatesAndNotDirectionOnMove() { var robot = Substitute.For <IRobot>(); robot.X.Returns(0); robot.Y.Returns(0); robot.FacingDirection.Returns(Direction.NORTH); var o = new Simulator.Executor(robot); o.Execute(CommandType.MOVE); robot.Received(1).X = 0; robot.Received(1).Y = 1; robot.DidNotReceive().FacingDirection = Arg.Any <Direction>(); }
public void TestExecuteReport() { var robot = Substitute.For <IRobot>(); robot.X.Returns(0); robot.Y.Returns(0); robot.FacingDirection.Returns(Direction.NORTH); var o = new Simulator.Executor(robot); var actual = string.Empty; var expected = "0,0,NORTH"; o.WriteLine = (s) => actual = s; o.Execute(CommandType.REPORT); Assert.AreEqual(expected, actual); }