コード例 #1
0
        public void TestOrientation(Orientation newOrientation)
        {
            positionTracker.SetOrientation(newOrientation);
            Orientation currentOrientation = positionTracker.GetOrientation();

            currentOrientation.ShouldBe(newOrientation);
        }
コード例 #2
0
        public void TestTurnAction(Orientation startingOrientation, Direction direction, Orientation expectedOrientation)
        {
            _positionTracker.SetOrientation(startingOrientation);
            var outcome = _movementProcessor.Turn(direction);

            outcome.Result.ShouldBe(OutcomeStatus.Success);
            var newOrientation = _positionTracker.GetOrientation();

            newOrientation.ShouldBe(expectedOrientation);
        }
コード例 #3
0
        /// <summary>
        /// Reports on the position of the robot. If the Robot has not yet been placed, then the PositionReport property <tt>HasRobotBeenPlaced</tt> will be <tt>false</tt>
        /// </summary>
        /// <returns></returns>
        public PositionReport Report()
        {
            var(positionX, positionY) = _positionTracker.GetPosition();

            if (!_positionTracker.HasRobotBeenPlaced)
            {
                return(new PositionReport());
            }

            return(new PositionReport
            {
                Orientation = _positionTracker.GetOrientation(),
                PositionX = positionX,
                PositionY = positionY,
                HasRobotBeenPlaced = _positionTracker.HasRobotBeenPlaced
            });
        }