Ejemplo n.º 1
0
        public void ProcessInstruction(string characters)
        {
            char[] array = characters.ToCharArray();

            foreach (char character in array)
            {
                setDirectionAction();
                if (character != 'M')
                {
                    this._compassDirection = _directionAction.Spin(character);
                }
                else
                {
                    if (this._compassDirection == 'N' || this._compassDirection == 'S')
                    {
                        this._ycoordinate = _directionAction.Move();
                    }
                    if (this._compassDirection == 'E' || this._compassDirection == 'W')
                    {
                        this._xcoordinate = _directionAction.Move();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void RoverMove_Returns_NewPosition()
        {
            int ycoodinate = _directionAction.Move();

            Assert.AreEqual(ycoodinate, 2);
        }