public void ShouldNotExecuteOutsideLimitsWhenOnPositivePosition() { var startingPosition = new Position(2, 0); const int steps = 5; const int positionLimit = 4; var command = new EastCommand(steps); var(lastPosition, positions) = command.Execute(startingPosition, positionLimit); var expectedLastPosition = new Position(4, 0); var expectedPositions = new List <Position> { new Position(2, 0), new Position(3, 0), new Position(4, 0) }; lastPosition.Should().Be(expectedLastPosition); positions.Should().BeEquivalentTo(expectedPositions); }
public void ShouldExecute() { var startingPosition = new Position(2, -3); const int steps = 3; const int positionLimit = 10; var command = new EastCommand(steps); var(lastPosition, positions) = command.Execute(startingPosition, positionLimit); var expectedLastPosition = new Position(5, -3); var expectedPositions = new List <Position> { new Position(2, -3), new Position(3, -3), new Position(4, -3), new Position(5, -3) }; lastPosition.Should().Be(expectedLastPosition); positions.Should().BeEquivalentTo(expectedPositions); }