public void TestTurnCommand(string commandText)
        {
            var direction = Enum.Parse <Direction>(commandText);

            _mockMovementProcessor.Turn(direction).Returns(info => new ActionOutcome(OutcomeStatus.Success));
            var outcome = _executor.ExecuteCommand(commandText);

            _mockMovementProcessor.Received().Turn(direction);
            outcome.Result.ShouldBe(OutcomeStatus.Success);
        }
Beispiel #2
0
        public void Execute(string[] cmdTokens = default)
        {
            //single element with the direction to turn
            var cmd       = cmdTokens?.FirstOrDefault();
            var direction = Enum.Parse <Direction>(cmd);
            var outcome   = _movementProcessor.Turn(direction);

            _callStack.Push(new Call(this, outcome));
        }
Beispiel #3
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);
        }