public void TestInvalidateTwiceSuperfluous()
        {
            var changes = new MergedLogSourceChanges(13);

            changes.RemoveFrom(5);
            changes.RemoveFrom(7);

            changes.Sections.Should().Equal(new object[]
            {
                LogSourceModification.Removed(5, 8)
            });

            changes.TryGetFirstRemovedIndex(out var index).Should().BeTrue();
            index.Should().Be(new LogLineIndex(5));
        }
        public void TestAppendInvalidate()
        {
            var changes = new MergedLogSourceChanges(0);

            changes.Append(0, 42);
            changes.RemoveFrom(20);

            changes.Sections.Should().Equal(new object[]
            {
                LogSourceModification.Appended(0, 20)
            });
        }
        public void TestInvalidateThenAppendWithGap()
        {
            var changes = new MergedLogSourceChanges(10);

            changes.RemoveFrom(5);
            changes.Append(7, 10);

            changes.Sections.Should().Equal(new object[]
            {
                LogSourceModification.Removed(5, 5),
                LogSourceModification.Appended(5, 12)
            });
        }
        public void TestInvalidate()
        {
            var changes = new MergedLogSourceChanges(42);

            changes.RemoveFrom(10);

            changes.Sections.Should().Equal(new object[]
            {
                LogSourceModification.Removed(10, 32)
            });

            changes.TryGetFirstRemovedIndex(out var index).Should().BeTrue();
            index.Should().Be(new LogLineIndex(10));
        }
        public void TestInvalidateThenAppend()
        {
            var changes = new MergedLogSourceChanges(10);

            changes.RemoveFrom(5);
            changes.Append(5, 6);

            changes.Sections.Should().Equal(new object[]
            {
                LogSourceModification.Removed(5, 5),
                LogSourceModification.Appended(5, 6)
            });

            changes.TryGetFirstRemovedIndex(out var index).Should().BeTrue();
            index.Should().Be(new LogLineIndex(5));
        }