public void ReadTestFileWithPlainLines()
 {
     using (var stream = TestLogFiles.OpenTestFileWithPlainLines())
     {
         var results = new SimpleLinePerLineReader(stream).ReadLines().ToList();
         results.Should().BeEquivalentTo(ExpectedResults);
     }
 }
 public void ReadTestFileWithYamlData()
 {
     using (var stream = TestLogFiles.OpenTestFileWithYamlData())
     {
         var results = new YamlConfigLogReader(stream).ReadLines().ToList();
         results.Should().BeEquivalentTo(ExpectedResults);
     }
 }
 public void ReadEmptyTestFile()
 {
     using (var stream = TestLogFiles.OpenEmptyTestFile())
     {
         var results = new SimpleLinePerLineReader(stream).ReadLines().ToList();
         results.Should().Equal(new List <ReadLogLineResult>());
     }
 }
Example #4
0
 public void ReadTestFileWithCsvData()
 {
     using (var stream = TestLogFiles.OpenTestFileWithCsvData())
     {
         var results = new CsvLogReader <TestEvent>(stream, null, null).ReadLines().ToList();
         results.Should().BeEquivalentTo(ExpectedResults);
     }
 }
Example #5
0
 public void ReadyEmptyTestFile()
 {
     using (var stream = TestLogFiles.OpenEmptyTestFile())
     {
         var results = new CsvLogReader <TestEvent>(stream, null, null).ReadLines().ToList();
         results.Should().Equal(new List <TestEvent>());
     }
 }
Example #6
0
 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 expectedResult = new List <ReadLogLineResult> {
                new ReadLogLineResult(0, null)
            };

            using (var stream = TestLogFiles.OpenTestFileWithPlainLines())
            {
                var results = new YamlConfigLogReader(stream).ReadLines().ToList();
                results.Should().BeEquivalentTo(expectedResult);
            }
        }
Example #8
0
        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);
        }
Example #9
0
        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);
        }