forked from LogExperts/LogExpert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJsonColumnizerTest.cs
39 lines (33 loc) · 1.18 KB
/
JsonColumnizerTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using LogExpert.Classes.Log;
using LogExpert.Entities;
using NUnit.Framework;
using System;
using System.IO;
namespace LogExpert.Tests
{
[TestFixture]
public class JsonColumnizerTest
{
[TestCase(@".\TestData\JsonColumnizerTest_01.txt", "time @m level")]
public void GetColumnNames_HappyFile_ColumnNameMatches(string fileName, string expectedHeaders)
{
var jsonColumnizer = new JsonColumnizer.JsonColumnizer();
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fileName);
LogfileReader reader = new(path, new EncodingOptions(), true, 40, 50, new MultiFileOptions());
reader.ReadFiles();
ILogLine line = reader.GetLogLine(0);
if (line != null)
{
jsonColumnizer.SplitLine(null, line);
}
line = reader.GetLogLine(1);
if (line != null)
{
jsonColumnizer.SplitLine(null, line);
}
var columnHeaders = jsonColumnizer.GetColumnNames();
var result = string.Join(" ", columnHeaders);
Assert.That(expectedHeaders, Is.EqualTo(result));
}
}
}