public void TestTimestampFormat4() { using (var file = new TextLogFile(_scheduler, @"TestData\Timestamps\ddd MMM dd HH_mm_ss.fff yyyy.txt")) { file.Property(x => x.EndOfSourceReached).ShouldAfter(TimeSpan.FromSeconds(5)).BeTrue(); file.Count.Should().Be(1); var line = file.GetLine(0); line.Timestamp.Should().Be(new DateTime(2017, 5, 5, 8, 46, 44, 257, DateTimeKind.Unspecified)); } }
public void TestTimestampFormat1() { using (var file = new TextLogFile(_scheduler, @"TestData\Timestamps\yyyy-MM-dd HH_mm_ss_fff.txt")) { file.Property(x => x.EndOfSourceReached).ShouldAfter(TimeSpan.FromSeconds(5)).BeTrue(); file.Count.Should().Be(1); var line = file.GetLine(0); line.Timestamp.Should().Be(new DateTime(2017, 5, 10, 20, 40, 3, 143, DateTimeKind.Unspecified)); } }
public void TestTimestampFormat3() { using (var file = new TextLogFile(_scheduler, @"TestData\Timestamps\HH_mm_ss.txt")) { file.Property(x => x.EndOfSourceReached).ShouldAfter(TimeSpan.FromSeconds(5)).BeTrue(); file.Count.Should().Be(1); var line = file.GetLine(0); var today = DateTime.Today; line.Timestamp.Should().Be(new DateTime(today.Year, today.Month, today.Day, 21, 04, 33, DateTimeKind.Unspecified)); } }
public void TestReadOneLine1() { _streamWriter.Write("Foo"); _streamWriter.Flush(); _scheduler.RunOnce(); _file.Count.Should().Be(1); _file.GetLine(0).Should().Be(new LogLine(0, 0, "Foo", LevelFlags.None)); }
public void TestEncodingLatin1() { _binaryWriter.Write((byte)0x36); _binaryWriter.Write((byte)0x35); _binaryWriter.Write((byte)0xB0); _binaryWriter.Write((byte)'\r'); _binaryWriter.Write((byte)'\n'); _binaryWriter.Flush(); _file = new TextLogFile(_scheduler, _fname, encoding: Encoding.GetEncoding(1252)); _scheduler.RunOnce(); _file.Count.Should().Be(1); var line = _file.GetLine(0); line.Message.Should().Be("65°"); }