public void ReadEmptyTestFile() { using (var stream = TestLogFiles.OpenEmptyTestFile()) { var reader = new NativeJsonLogsReader(stream, null, null); var results = reader.ReadLines().ToList(); results.Should().Equal(new List <ReadLogLineResult>()); } }
public void ReadTestFileWithPlainLines() { var expectedResults = new List <ReadLogLineResult>(); for (var i = 1; i <= 6; ++i) { expectedResults.Add(new ReadLogLineResult(i, null)); } var processingNotificationsCollector = new ProcessingNotificationsCollector(10); using (var stream = TestLogFiles.OpenTestFileWithPlainLines()) { var reader = new NativeJsonLogsReader(stream, "testFile.txt", processingNotificationsCollector); var results = reader.ReadLines().ToList(); results.Should().BeEquivalentTo(expectedResults); } processingNotificationsCollector.TotalErrorsReported.Should().Be(6); }
public void VerifyDifferentJsonStrings() { var processingNotificationsCollector = new ProcessingNotificationsCollector(10); using (var stream = TestLogFiles.OpenTestFileWithJsonData()) { var reader = new NativeJsonLogsReader(stream, "testFile.txt", processingNotificationsCollector); var results = reader.ReadLines().ToList(); results.Should().BeEquivalentTo(ExpectedResults); // This extra steps are needed to confirm JToken equality (BeEquivalentTo above cannot do it) var actualPayload = ExtractPayloadAsStrings(results); var expectedPayload = ExtractPayloadAsStrings(ExpectedResults); actualPayload.Should().BeEquivalentTo(expectedPayload); var actualArtData = ExtractArtDataAsStrings(results); var expectedArtData = ExtractArtDataAsStrings(ExpectedResults); actualArtData.Should().BeEquivalentTo(expectedArtData); } processingNotificationsCollector.TotalErrorsReported.Should().Be(3); }