Add test showing that reverse handles numbers less than zero.

This commit is contained in:
Kristian Stolen
2022-01-13 16:32:55 +08:00
parent ed50c3e24b
commit 4f2bc6f98c

View File

@@ -87,6 +87,19 @@ namespace Reverse.Tests
Assert.True(sut.GetArray().SequenceEqual(output)); Assert.True(sut.GetArray().SequenceEqual(output));
} }
[Fact]
public void Reverse_WithIndexLessThanZero_DoesNothing()
{
var input = new int[] { 1, 2 };
var output = new int[] { 1, 2 };
var sut = new TestReverser(1);
sut.SetArray(input);
sut.Reverse(-1);
Assert.True(sut.GetArray().SequenceEqual(output));
}
[Theory] [Theory]
[InlineData(new int[] { 1 })] [InlineData(new int[] { 1 })]
[InlineData(new int[] { 1, 2 })] [InlineData(new int[] { 1, 2 })]