示例#1
0
        public void ShouldNotExecuteOutsideLimitOnSouthDirectionWhenOnNegativePosition()
        {
            var       startingPosition = new Position(0, -2);
            const int steps            = 5;
            const int positionLimit    = 4;

            var command = new SouthCommand(steps);

            var(lastPosition, positions) = command.Execute(startingPosition, positionLimit);

            var expectedLastPosition = new Position(0, -4);
            var expectedPositions    = new List <Position>
            {
                new Position(0, -2),
                new Position(0, -3),
                new Position(0, -4)
            };

            lastPosition.Should().Be(expectedLastPosition);
            positions.Should().BeEquivalentTo(expectedPositions);
        }
示例#2
0
        public void ShouldExecute()
        {
            var       startingPosition = new Position(2, -3);
            const int steps            = 3;
            const int positionLimit    = 10;

            var command = new SouthCommand(steps);

            var(lastPosition, positions) = command.Execute(startingPosition, positionLimit);

            var expectedLastPosition = new Position(2, -6);
            var expectedPositions    = new List <Position>
            {
                new Position(2, -3),
                new Position(2, -4),
                new Position(2, -5),
                new Position(2, -6)
            };

            lastPosition.Should().Be(expectedLastPosition);
            positions.Should().BeEquivalentTo(expectedPositions);
        }