Example #1
0
        public void GivenARobotMove_IfThereIsNOScent_RobotIsLost()
        {
            IEnumerable <Position> scents = null;
            var currentPostion            = new Position {
                PositionX = 2, PositionY = 3, Orientation = Orientation.N
            };
            List <IMoveCommand> movements = MoveCommand_Extensions.ForwardCommands();

            var _sut = new RobotMoveService(movements, scents, _marsGrid);

            var result = _sut.GetFinalPosition(currentPostion);

            Assert.True(result.IsLost &&
                        result.Position.PositionX == 2 &&
                        result.Position.PositionY == 3 &&
                        result.Position.Orientation == Orientation.N);
        }
Example #2
0
        public void GivenARobotMove_IfIsInScentPositionPreventItToFall()
        {
            var scents = new List <Position> {
                new Position {
                    PositionX = 2, PositionY = 3
                }
            };
            var currentPostion = new Position {
                PositionX = 2, PositionY = 2, Orientation = Orientation.N
            };
            List <IMoveCommand> movements = MoveCommand_Extensions.ForwardCommands();

            var _sut = new RobotMoveService(movements, scents, _marsGrid);

            var result = _sut.GetFinalPosition(currentPostion);

            Assert.True(!result.IsLost &&
                        result.Position.PositionX == 2 &&
                        result.Position.PositionY == 3 &&
                        result.Position.Orientation == Orientation.S);
        }