forked from LogExperts/LogExpert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJsonCompactColumnizerTest.cs
42 lines (40 loc) · 1.8 KB
/
JsonCompactColumnizerTest.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
40
41
42
using LogExpert.Classes.Log;
using LogExpert.Entities;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.IO;
namespace LogExpert.Tests
{
[TestFixture]
public class JsonCompactColumnizerTest
{
[TestCase(@".\TestData\JsonCompactColumnizerTest_01.json", Priority.PerfectlySupport)]
// As long as the json file contains one of the pre-defined key, it's perfectly supported.
[TestCase(@".\TestData\JsonCompactColumnizerTest_02.json", Priority.PerfectlySupport)]
[TestCase(@".\TestData\JsonCompactColumnizerTest_03.json", Priority.WellSupport)]
public void GetPriority_HappyFile_PriorityMatches(string fileName, Priority priority)
{
var jsonCompactColumnizer = new JsonColumnizer.JsonCompactColumnizer();
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fileName);
LogfileReader logFileReader = new(path, new EncodingOptions(), true, 40, 50, new MultiFileOptions());
logFileReader.ReadFiles();
List<ILogLine> loglines = new()
{
// Sampling a few lines to select the correct columnizer
logFileReader.GetLogLine(0),
logFileReader.GetLogLine(1),
logFileReader.GetLogLine(2),
logFileReader.GetLogLine(3),
logFileReader.GetLogLine(4),
logFileReader.GetLogLine(5),
logFileReader.GetLogLine(25),
logFileReader.GetLogLine(100),
logFileReader.GetLogLine(200),
logFileReader.GetLogLine(400)
};
var result = jsonCompactColumnizer.GetPriority(path, loglines);
Assert.That(result, Is.EqualTo(priority));
}
}
}