Skip to content

Commit 7299367

Browse files
committed
SequentialGenerator modifications
1 parent 610fc18 commit 7299367

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

NTestDataBuilder.Tests/DataSources/Generators/SequentiaGeneratorTests.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ namespace NTestDataBuilder.Tests.DataSources.Generators
99
public class SequentiaGeneratorTests
1010
{
1111
[Theory,
12-
InlineData(0, 0),
1312
InlineData(5, 4),
1413
InlineData(5, 5)]
1514
public void WhenCreatingRandomGenerator_ThenStartIndexMustBeLessThanListSize(int startIndex, int listSize)
@@ -42,7 +41,7 @@ public void WhenCreatingRandomGenerator_ThenListSizeMustBeGreaterThanZero(int st
4241
public void WhenGeneratingIntegers_ThenShouldBeSequential()
4342
{
4443
var sut = new SequentialGenerator(0, 11);
45-
for (int index = sut.StartIndex; index <= sut.ListSize; index++)
44+
for (int index = sut.StartIndex; index < sut.ListSize; index++)
4645
{
4746
sut.Generate().ShouldBe(index);
4847
}
@@ -52,7 +51,7 @@ public void WhenGeneratingIntegers_ThenShouldBeSequential()
5251
public void GivenGeneratorIsNotUnique_WhenGeneratingIntegers_ThenShouldResetAtEndOfList()
5352
{
5453
var sut = new SequentialGenerator(0, 2);
55-
for (int index = sut.StartIndex; index <= sut.ListSize; index++)
54+
for (int index = sut.StartIndex; index < sut.ListSize; index++)
5655
{
5756
sut.Generate().ShouldBe(index);
5857
}
@@ -64,7 +63,7 @@ public void GivenGeneratorIsNotUnique_WhenGeneratingIntegers_ThenShouldResetAtEn
6463
public void GivenGeneratorIsUnique_WhenGeneratingIntegers_ThenShouldResetAtEndOfList()
6564
{
6665
var sut = new SequentialGenerator(0, 2, true);
67-
for (int index = sut.StartIndex; index <= sut.ListSize; index++)
66+
for (int index = sut.StartIndex; index < sut.ListSize; index++)
6867
{
6968
sut.Generate().ShouldBe(index);
7069
}

NTestDataBuilder/DataSources/Generators/SequentialGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public int Generate()
3030

3131
private void CheckForEndOfList()
3232
{
33-
if (_currentListIndex <= ListSize)
33+
if (_currentListIndex < ListSize)
3434
{
3535
return;
3636
}

0 commit comments

Comments
 (0)