Esempio n. 1
0
        public void PlaceCommand(int inputX, int inputY, int inputDirection, int expectedX, int expectedY,
                                 int expectedDirection)
        {
            var robot     = new Robot();
            var simulator = new RobotSimulatorCommand();

            simulator.Place(robot, new Position()
            {
                XAxis             = inputX,
                YAxis             = inputY,
                CardinalDirection = (CardinalDirection)inputDirection
            });

            var positionStatus = simulator.Report(robot);

            Assert.True(positionStatus.CurrentPosition.XAxis == expectedX &&
                        positionStatus.CurrentPosition.YAxis == expectedY &&
                        positionStatus.CurrentPosition.CardinalDirection == (CardinalDirection)expectedDirection
                        );
        }
Esempio n. 2
0
        public void RunMultipleCommands_InputX0Y0East_ReturnX3Y3North()
        {
            var robot     = new Robot();
            var simulator = new RobotSimulatorCommand();

            simulator.Place(robot, new Position()
            {
                XAxis             = 1,
                YAxis             = 2,
                CardinalDirection = CardinalDirection.East
            });

            simulator.Move(robot);
            simulator.Move(robot);
            simulator.Left(robot);
            simulator.Move(robot);

            var positionStatus = simulator.Report(robot);

            Assert.True(positionStatus.CurrentPosition.XAxis == 3 &&
                        positionStatus.CurrentPosition.YAxis == 3 &&
                        positionStatus.CurrentPosition.CardinalDirection == CardinalDirection.North
                        );
        }