示例#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();
                    }
                }
            }
        }
示例#2
0
        public void RoverSpin_Returns_NewDirection(char direction, char result)
        {
            char newDirection = _directionAction.Spin(direction);

            Assert.AreEqual(newDirection, result);
        }