public void MovePacInClockWiseCircle() { var service = new PacSimGridMovementService(3, 3); var startPos = service.Place(0, 0, PacDirection.NORTH); service.Move(); service.Move(); service.Right(); service.Move(); service.Move(); service.Right(); service.Move(); service.Move(); service.Right(); service.Move(); service.Move(); service.Right(); var endPos = service.Report(); Assert.AreEqual(startPos, endPos); }
public void MovePacInCounterClockWiseCircle() { var service = new PacSimGridMovementService(3, 3); var startPos = service.Place(2, 2, PacDirection.WEST); service.Move(); service.Move(); service.Left(); service.Move(); service.Move(); service.Left(); service.Move(); service.Move(); service.Left(); service.Move(); service.Move(); service.Left(); var endPos = service.Report(); Assert.AreEqual(startPos, endPos); }
public void MovePacOnGrid(int width, int height, int moveTimes, int startX, int startY, PacDirection startFacing, int expectedX, int expectedY) { var service = new PacSimGridMovementService(width, height); service.Place(startX, startY, startFacing); try { for (int i = 0; i < moveTimes; i++) { service.Move(); } } catch (Exception) { } var newPos = service.Report(); Assert.IsNotNull(newPos); Assert.AreEqual(expectedX, newPos.Value.X, "X position doesn't match"); Assert.AreEqual(expectedY, newPos.Value.Y, "Y position doesn't match"); }