コード例 #1
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);
        }
コード例 #2
0
        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));
        }