public void MMRMMRMRRM_Should_Result_Into_51E() { var initialPosition = new PositionModel { Orientation = Orientation.E, Coordinates = new CoordinatesModel { X = 3, Y = 3 } }; var robot = new Robot(initialPosition, _upperRight); robot.Move(new List<Instruction> { Instruction.M, Instruction.M, Instruction.R, Instruction.M, Instruction.M, Instruction.R, Instruction.M, Instruction.R, Instruction.R, Instruction.M }); var position = robot.GetPosition(); Assert.AreEqual(5, position.Coordinates.X); Assert.AreEqual(1, position.Coordinates.Y); Assert.AreEqual(Orientation.E, position.Orientation); }
public void LMLMLMLMM_Should_Result_Into_13N() { var initialPosition = new PositionModel { Orientation = Orientation.N, Coordinates = new CoordinatesModel { X = 1, Y = 2 } }; var robot = new Robot(initialPosition, _upperRight); robot.Move(new List<Instruction> { Instruction.L, Instruction.M, Instruction.L, Instruction.M, Instruction.L, Instruction.M, Instruction.L, Instruction.M, Instruction.M }); var position = robot.GetPosition(); Assert.AreEqual(1, position.Coordinates.X); Assert.AreEqual(3, position.Coordinates.Y); Assert.AreEqual(Orientation.N, position.Orientation); }
public void Given_A_Robot() { _initialPosition = new PositionModel { Orientation = Orientation.N, Coordinates = new CoordinatesModel { X = 1, Y = 1 } }; _robot = new Robot(_initialPosition, new CoordinatesModel { X = 3, Y = 3 }); }
public Robot(PositionModel position, CoordinatesModel upperRight) { _position = position; _upperRight = upperRight; }
public void Given_A_Robot() { _initialPosition = new PositionModel { Orientation = Orientation.N, Coordinates = new CoordinatesModel { X = _upperRight.X, Y = _upperRight.Y } }; _robot = new Robot(_initialPosition, _upperRight); }