Beispiel #1
0
        public void TestGetTimestamp1()
        {
            var source     = new InMemoryLogFile();
            var logFile    = new MultiLineLogFile(_taskScheduler, source, TimeSpan.Zero);
            var timestamps = logFile.GetColumn(new LogFileSection(0, 1), LogFileColumns.Timestamp);

            timestamps.Should().NotBeNull();
            timestamps.Should().Equal(new object[] { null }, "because accessing non-existant rows should simply return default values");
        }
Beispiel #2
0
        public void TestGetTimestamp2()
        {
            var source = new InMemoryLogFile();

            var timestamp = DateTime.UtcNow;

            source.AddEntry("", LevelFlags.None, timestamp);

            var logFile = new MultiLineLogFile(_taskScheduler, source, TimeSpan.Zero);

            _taskScheduler.RunOnce();

            var timestamps = logFile.GetColumn(new LogFileSection(0, 1), LogFileColumns.Timestamp);

            timestamps.Should().NotBeNull();
            timestamps.Should().Equal(new object[] { timestamp });
        }
Beispiel #3
0
        public void TestGetTimestamp4()
        {
            var source = new InMemoryLogFile();

            var timestamp1 = new DateTime(2017, 12, 11, 20, 33, 0);

            source.AddEntry("", LevelFlags.Debug, timestamp1);

            var timestamp2 = new DateTime(2017, 12, 11, 20, 34, 0);

            source.AddEntry("", LevelFlags.Debug, timestamp2);
            source.AddEntry("", LevelFlags.None);

            var logFile = new MultiLineLogFile(_taskScheduler, source, TimeSpan.Zero);

            var timestamps = logFile.GetColumn(new LogFileSection(1, 2), LogFileColumns.Timestamp);

            timestamps.Should().NotBeNull();
            timestamps.Should().Equal(new object[] { timestamp2, timestamp2 });
        }
        public void TestGetTimestampByIndices()
        {
            var source = new InMemoryLogFile();

            var timestamp1 = new DateTime(2017, 12, 11, 20, 33, 0);

            source.AddEntry("", LevelFlags.Debug, timestamp1);

            var timestamp2 = new DateTime(2017, 12, 11, 20, 34, 0);

            source.AddEntry("", LevelFlags.Debug, timestamp2);
            source.AddEntry("", LevelFlags.Other);

            var logFile = new MultiLineLogFile(_taskScheduler, source, TimeSpan.Zero);

            _taskScheduler.RunOnce();

            var timestamps = logFile.GetColumn(new LogLineIndex[] { 0, 1, 2 }, LogFileColumns.Timestamp);

            timestamps.Should().NotBeNull();
            timestamps.Should().Equal(new object[] { timestamp1, timestamp2, timestamp2 });
        }