public void TestInvalidate2()
        {
            var logFile = new InMemoryLogSource();

            logFile.AddEntry("What's up people?");
            logFile.AddEntry("Hello World!");
            logFile.AddEntry("Looks like a bug");
            using (var search = new LogSourceSearch(_scheduler, logFile, "l", TimeSpan.Zero))
            {
                _scheduler.RunOnce();
                search.Matches.Should().HaveCount(6);

                logFile.RemoveFrom(0);
                search.Matches.Should().HaveCount(6);

                _scheduler.RunOnce();
                search.Matches.Should().HaveCount(0, "because we've removed all lines");
            }
        }
        public void TestInvalidate1()
        {
            var logFile = new InMemoryLogSource();

            logFile.AddEntry("What's up people?");
            logFile.AddEntry("Hello World!");
            logFile.AddEntry("Looks like a bug");
            using (var search = new LogSourceSearch(_scheduler, logFile, "l", TimeSpan.Zero))
            {
                _scheduler.RunOnce();
                search.Matches.Should().HaveCount(6);

                logFile.RemoveFrom(1);
                search.Matches.Should().HaveCount(6);

                _scheduler.RunOnce();
                search.Matches.Should().HaveCount(1, "because we've removed the second and third line, thus removing 5 of the 6 hits in the log source");
                search.Matches.Should().Equal(new LogMatch(0, new LogLineMatch(14, 1)));
            }
        }
Exemple #3
0
        public void TestPartialInvalidate()
        {
            var logFile = new InMemoryLogSource();
            var index   = new PresentationLogSource(_scheduler, logFile, TimeSpan.Zero, TextSettings.Default);

            logFile.Add(new LogEntry {
                RawContent = "Foo"
            });
            _scheduler.RunOnce();
            index.MaximumWidth.Should().BeApproximately(19.8, 0.1);
            index.LineCount.Should().Be(1);

            logFile.Add(new LogEntry {
                RawContent = "Hello,\r\nWorld!"
            });
            _scheduler.RunOnce();
            index.MaximumWidth.Should().BeApproximately(46.2, 0.1);
            index.LineCount.Should().Be(3);

            logFile.RemoveFrom(1);
            _scheduler.RunOnce();
            index.MaximumWidth.Should().BeApproximately(19.8, 0.1);
            index.LineCount.Should().Be(1);
        }