public void TestConstruction2() { var entry = new LogEntry2(LogFileColumns.RawContent, LogFileColumns.DeltaTime); entry.RawContent.Should().Be(LogFileColumns.RawContent.DefaultValue); entry.DeltaTime.Should().Be(LogFileColumns.DeltaTime.DefaultValue); }
public void TestSetValueWrongType() { var entry = new LogEntry2(); new Action(() => entry.SetValue(LogFileColumns.RawContent, 42)).Should().Throw <ArgumentException>(); entry.Columns.Should().BeEmpty(); new Action(() => entry.GetValue(LogFileColumns.RawContent)).Should().Throw <ArgumentException>(); }
public void TestConstruction3() { var entry = new LogEntry2(new List <ILogFileColumn> { LogFileColumns.Timestamp, LogFileColumns.LineNumber }); entry.Timestamp.Should().Be(LogFileColumns.Timestamp.DefaultValue); entry.LineNumber.Should().Be(LogFileColumns.LineNumber.DefaultValue); }
private ILogEntry CreateIndex(IReadOnlyLogEntry logEntry) { int numLines; var width = EstimateWidth(logEntry.RawContent, out numLines); var index = new LogEntry2(); index.SetValue(LogFileColumns.RawContentMaxPresentationWidth, width); index.SetValue(LogFileColumns.PresentationLineCount, numLines); return(index); }
public void TestSetElapsedTime() { var entry = new LogEntry2(); entry.Columns.Should().BeEmpty(); entry.ElapsedTime = TimeSpan.FromSeconds(23); entry.ElapsedTime.Should().Be(TimeSpan.FromSeconds(23)); entry.Columns.Should().Equal(LogFileColumns.ElapsedTime); entry.GetValue(LogFileColumns.ElapsedTime).Should().Be(TimeSpan.FromSeconds(23)); }
public void TestSetLogEntryIndex() { var entry = new LogEntry2(); entry.Columns.Should().BeEmpty(); entry.LogEntryIndex = 42; entry.LogEntryIndex.Should().Be(42); entry.Columns.Should().Equal(LogFileColumns.LogEntryIndex); entry.GetValue(LogFileColumns.LogEntryIndex).Should().Be(42); }
public void TestSetLogLevel() { var entry = new LogEntry2(); entry.Columns.Should().BeEmpty(); entry.LogLevel = LevelFlags.Fatal; entry.LogLevel.Should().Be(LevelFlags.Fatal); entry.Columns.Should().Equal(LogFileColumns.LogLevel); entry.GetValue(LogFileColumns.LogLevel).Should().Be(LevelFlags.Fatal); }
public void TestSetLineNumber() { var entry = new LogEntry2(); entry.Columns.Should().BeEmpty(); entry.LineNumber = 42; entry.LineNumber.Should().Be(42); entry.Columns.Should().Equal(LogFileColumns.LineNumber); entry.GetValue(LogFileColumns.LineNumber).Should().Be(42); }
public void TestSetOriginalLineNumber() { var entry = new LogEntry2(); entry.Columns.Should().BeEmpty(); entry.OriginalLineNumber = 1337; entry.OriginalLineNumber.Should().Be(1337); entry.Columns.Should().Equal(LogFileColumns.OriginalLineNumber); entry.GetValue(LogFileColumns.OriginalLineNumber).Should().Be(1337); }
public void TestSetOriginalIndex() { var entry = new LogEntry2(); entry.Columns.Should().BeEmpty(); entry.OriginalIndex = 8999; entry.OriginalIndex.Should().Be(8999); entry.Columns.Should().Equal(LogFileColumns.OriginalIndex); entry.GetValue(LogFileColumns.OriginalIndex).Should().Be(8999); }
public void TestSetIndex() { var entry = new LogEntry2(); entry.Columns.Should().BeEmpty(); entry.Index = 9001; entry.Index.Should().Be(9001); entry.Columns.Should().Equal(LogFileColumns.Index); entry.GetValue(LogFileColumns.Index).Should().Be(9001); }
public void TestSetRawContent() { var entry = new LogEntry2(); entry.Columns.Should().BeEmpty(); entry.RawContent = "The last Jedi"; entry.RawContent.Should().Be("The last Jedi"); entry.Columns.Should().Equal(LogFileColumns.RawContent); entry.GetValue(LogFileColumns.RawContent).Should().Be("The last Jedi"); }
public void TestSetTimestamp() { var entry = new LogEntry2(); entry.Columns.Should().BeEmpty(); entry.Timestamp = new DateTime(2017, 12, 20, 13, 33, 0); entry.Timestamp.Should().Be(new DateTime(2017, 12, 20, 13, 33, 0)); entry.Columns.Should().Equal(LogFileColumns.Timestamp); entry.GetValue(LogFileColumns.Timestamp).Should().Be(new DateTime(2017, 12, 20, 13, 33, 0)); }
public void TestAddEntry6() { var logFile = new InMemoryLogFile(LogFileColumns.LogLevel); var logEntry = new LogEntry2(); logEntry.Add(LogFileColumns.LogLevel, LevelFlags.Error); logFile.Add(logEntry); var buffer = new LogEntryBuffer(1, LogFileColumns.LogLevel); logFile.GetEntries(new LogFileSection(0, 1), buffer); buffer[0].LogLevel.Should().Be(LevelFlags.Error); }
public void TestConstruction1() { var entry = new LogEntry2(); entry.Columns.Should().BeEmpty(); new Action(() => { var unused = entry.DeltaTime; }).Should().Throw <NoSuchColumnException>(); new Action(() => { var unused = entry.ElapsedTime; }).Should().Throw <NoSuchColumnException>(); new Action(() => { var unused = entry.Index; }).Should().Throw <NoSuchColumnException>(); new Action(() => { var unused = entry.LineNumber; }).Should().Throw <NoSuchColumnException>(); new Action(() => { var unused = entry.LogEntryIndex; }).Should().Throw <NoSuchColumnException>(); new Action(() => { var unused = entry.LogLevel; }).Should().Throw <NoSuchColumnException>(); new Action(() => { var unused = entry.OriginalIndex; }).Should().Throw <NoSuchColumnException>(); new Action(() => { var unused = entry.OriginalLineNumber; }).Should().Throw <NoSuchColumnException>(); new Action(() => { var unused = entry.RawContent; }).Should().Throw <NoSuchColumnException>(); new Action(() => { var unused = entry.Timestamp; }).Should().Throw <NoSuchColumnException>(); }
public void TestAddPartialEntry() { var entries = new LogEntryList(LogFileColumns.RawContent, LogFileColumns.Timestamp); var logEntry = new LogEntry2(); logEntry.Add(LogFileColumns.RawContent, "Foobar"); entries.Add(logEntry); logEntry = new LogEntry2(); logEntry.Add(LogFileColumns.Timestamp, new DateTime(2017, 12, 19, 16, 08, 0)); entries.Add(logEntry); entries[0].RawContent.Should().Be("Foobar"); entries[0].Timestamp.Should().BeNull(); entries[1].RawContent.Should().BeNull(); entries[1].Timestamp.Should().Be(new DateTime(2017, 12, 19, 16, 08, 0)); }