public void TestMultiLineLogEntry2() { using (var file = new FilteredLogFile(_taskScheduler, TimeSpan.Zero, _logFile.Object, Filter.Create("yikes", true, LevelFlags.All))) { _entries.Add(new LogLine(0, 0, "DEBUG: This is a test", LevelFlags.Debug)); _entries.Add(new LogLine(1, 0, "Yikes", LevelFlags.None)); file.OnLogFileModified(_logFile.Object, new LogFileSection(0, 2)); _taskScheduler.RunOnce(); file.EndOfSourceReached.Should().BeTrue(); file.Count.Should().Be(2); file.GetSection(new LogFileSection(0, 2)) .Should().Equal(new[] { new LogLine(0, 0, "DEBUG: This is a test", LevelFlags.Debug), new LogLine(1, 0, "Yikes", LevelFlags.None) }); } }
public void TestEntryLevelNone() { using (var file = new FilteredLogFile(_taskScheduler, TimeSpan.Zero, _logFile.Object, Filter.Create("ello", true, LevelFlags.All))) { _entries.Add(new LogLine(0, "Hello world!", LevelFlags.None)); file.OnLogFileModified(_logFile.Object, new LogFileSection(0, 1)); _taskScheduler.RunOnce(); file.EndOfSourceReached.Should().BeTrue(); file.Count.Should().Be(1); file.GetSection(new LogFileSection(0, 1)) .Should().Equal(new[] { new LogLine(0, "Hello world!", LevelFlags.None) }); } }
public void TestGetSection1() { using (var file = new FilteredLogFile(_taskScheduler, TimeSpan.Zero, _logFile.Object, Filter.Create("yikes", true, LevelFlags.All))) { _entries.Add(new LogLine(0, 0, "DEBUG: This is a test", LevelFlags.Debug)); _entries.Add(new LogLine(1, 1, "Yikes", LevelFlags.None)); file.OnLogFileModified(_logFile.Object, new LogFileSection(0, 2)); _taskScheduler.RunOnce(); file.EndOfSourceReached.Should().BeTrue(); var section = file.GetSection(new LogFileSection(0, 1)); section.Should().NotBeNull(); section.Length.Should().Be(1); section[0].LineIndex.Should().Be(0, "because the filtered log file only represents a file with one line, thus the only entry should have an index of 0, not 1, which is the original index"); section[0].Message.Should().Be("Yikes"); } }