TailBlazer
TailBlazer copied to clipboard
Negative Index when reading lines using scroll request with position
Reading lines using a ScrollRequest
with a position
instead of a firstIndex
result in a negative Index
for the first line.
[Fact]
public void IndexShouldNotBeNegative()
{
var firstLine = "This is the first line";
ILineProvider result = null;
var pulse = new Subject<Unit>();
using (var file = new TestFile())
using (file.Info
.WatchFile(pulse)
.Index()
.Subscribe(x => result = x))
{
file.Append(firstLine);
pulse.Once();
var lines = result.ReadLines(new ScrollRequest(10, (long)4)).ToArray();
lines.Single().Index.Should().BeGreaterOrEqualTo(0);
}
}