public void DirectionalMovement(Orientation orientation, int x, int y) { //arrange var mars = new Mars(5, 3); var robot = new Robot(1, 1, orientation, mars); //act robot.ExecuteCommand(Command.forward); //assert Assert.AreEqual(x, robot.X); Assert.AreEqual(y, robot.Y); }
public void Boundaries(Orientation orientation, int timesForward, bool shouldBeLost) { //arrange var mars = new Mars(5, 3); var robot = new Robot(1, 1, orientation, mars); //act for(int i=0; i<timesForward; i++) robot.ExecuteCommand(Command.forward); //assert Assert.AreEqual(shouldBeLost, robot.IsLost); }
public void ReportLastPositionIfFallenOff() { //arrange var mars = new Mars(5, 3); var lostRobot = new Robot(5, 3, Orientation.north, mars); //act lostRobot.ExecuteCommand(Command.forward); lostRobot.ExecuteCommand(Command.forward); //assert //lost robot's position should be the last one if had before falling off Assert.AreEqual(5, lostRobot.X); Assert.AreEqual(3, lostRobot.Y); }
public void Reorientation(Command command, int timesRotate, Orientation orientation) { //arrange var mars = new Mars(5, 3); var robot = new Robot(0, 0, Orientation.north, mars); //act for(int i=0; i<timesRotate; i++) robot.ExecuteCommand(command); //assert Assert.AreEqual(orientation, robot.Orientation); Assert.AreEqual(0, robot.X); Assert.AreEqual(0, robot.Y); }
public void SniffForScentsBeforeFallingOff() { //arrange var mars = new Mars(5, 3); var lostRobot = new Robot(5, 3, Orientation.north, mars); var savedRobot = new Robot(5, 3, Orientation.north, mars); //act lostRobot.ExecuteCommand(Command.forward); savedRobot.ExecuteCommand(Command.forward); //assert Assert.AreEqual(true, lostRobot.IsLost); Assert.AreEqual(false, savedRobot.IsLost); }