public void TestLastModified() { var lastModified = new DateTime(2017, 12, 21, 20, 52, 0); _logFile.Setup(x => x.GetValue(LogFileProperties.LastModified)).Returns(lastModified); using (var file = new FilteredLogFile(_taskScheduler, TimeSpan.Zero, _logFile.Object, null, Filter.Create(null, true, LevelFlags.Info))) { _taskScheduler.RunOnce(); file.GetValue(LogFileProperties.LastModified).Should().Be(lastModified, "because the last modification date of the source should be forwarded since that is of interest to the user"); } }
public void TestSize() { var size = Size.FromGigabytes(5); _logFile.Setup(x => x.GetValue(LogFileProperties.Size)).Returns(size); using (var file = new FilteredLogFile(_taskScheduler, TimeSpan.Zero, _logFile.Object, null, Filter.Create(null, true, LevelFlags.Info))) { _taskScheduler.RunOnce(); file.GetValue(LogFileProperties.Size).Should().Be(size, "because the size of the source should be forwarded since that is of interest to the user"); } }
public void TestFilter1() { using (var file = new TextLogFile(_scheduler, File20Mb)) { file.Property(x => x.Count).ShouldEventually().Be(165342, TimeSpan.FromSeconds(5)); using (FilteredLogFile filtered = file.AsFiltered(_scheduler, null, Filter.Create("info"))) { filtered.Property(x => x.Count).ShouldEventually().Be(5, TimeSpan.FromSeconds(5)); filtered.GetValue(LogFileProperties.StartTimestamp).Should().Be(new DateTime(2015, 10, 7, 19, 50, 58, 982)); LogLine[] section = filtered.GetSection(new LogFileSection(0, 5)); section.Should().Equal(new[] { new LogLine(0, 0, "2015-10-07 19:50:58,982 [8092, 1] INFO SharpRemote.Hosting.OutOfProcessSiloServer (null) - Silo Server starting, args (1): \"14056\", without custom type resolver", LevelFlags.Info, new DateTime(2015, 10, 7, 19, 50, 58, 982, DateTimeKind.Unspecified)), new LogLine(1, 1, "2015-10-07 19:50:59,081 [8092, 1] INFO SharpRemote.SocketRemotingEndPointServer (null) - EndPoint '<Unnamed>' listening on 0.0.0.0:49152", LevelFlags.Info, new DateTime(2015, 10, 7, 19, 50, 59, 081)), new LogLine(2, 2, "2015-10-07 19:50:59,171 [8092, 6] INFO SharpRemote.AbstractIPSocketRemotingEndPoint (null) - <Unnamed>: Connected to 127.0.0.1:10348", LevelFlags.Info, new DateTime(2015, 10, 7, 19, 50, 59, 171)), new LogLine(3, 3, "2015-10-07 19:51:42,481 [8092, EndPoint '<Unnamed>' Socket Reading] INFO SharpRemote.AbstractSocketRemotingEndPoint (null) - Disconnecting socket '<Unnamed>' from 127.0.0.1:10348: ReadFailure", LevelFlags.Info, new DateTime(2015, 10, 7, 19, 51, 42, 481)), new LogLine(4, 4, "2015-10-07 19:51:42,483 [8092, 6] INFO SharpRemote.Hosting.OutOfProcessSiloServer (null) - Parent process terminated unexpectedly (exit code: -1), shutting down...", LevelFlags.Info, new DateTime(2015, 10, 7, 19, 51, 42, 483)) }); } } }