2020-12-18 23:06:28 -08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using SabreTools.Filtering;
|
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace SabreTools.Test.Filtering
|
|
|
|
|
{
|
2020-12-19 13:57:45 -08:00
|
|
|
public class PopulationTests
|
2020-12-18 23:06:28 -08:00
|
|
|
{
|
|
|
|
|
[Fact]
|
|
|
|
|
public void PopulateExclusionNullListTest()
|
|
|
|
|
{
|
|
|
|
|
// Setup the list
|
2024-03-05 13:32:49 -05:00
|
|
|
List<string>? exclusions = null;
|
2020-12-18 23:06:28 -08:00
|
|
|
|
2021-02-01 12:11:32 -08:00
|
|
|
// Setup the remover
|
|
|
|
|
var remover = new Remover();
|
|
|
|
|
remover.PopulateExclusionsFromList(exclusions);
|
2020-12-18 23:06:28 -08:00
|
|
|
|
|
|
|
|
// Check the exclusion lists
|
2024-03-05 16:37:52 -05:00
|
|
|
Assert.Empty(remover.HeaderFieldNames);
|
|
|
|
|
Assert.Empty(remover.MachineFieldNames);
|
|
|
|
|
Assert.Empty(remover.ItemFieldNames);
|
2020-12-18 23:06:28 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void PopulateExclusionEmptyListTest()
|
|
|
|
|
{
|
|
|
|
|
// Setup the list
|
2024-03-05 16:37:52 -05:00
|
|
|
List<string> exclusions = [];
|
2020-12-18 23:06:28 -08:00
|
|
|
|
2021-02-01 12:11:32 -08:00
|
|
|
// Setup the remover
|
|
|
|
|
var remover = new Remover();
|
|
|
|
|
remover.PopulateExclusionsFromList(exclusions);
|
2020-12-18 23:06:28 -08:00
|
|
|
|
|
|
|
|
// Check the exclusion lists
|
2024-03-05 16:37:52 -05:00
|
|
|
Assert.Empty(remover.HeaderFieldNames);
|
|
|
|
|
Assert.Empty(remover.MachineFieldNames);
|
|
|
|
|
Assert.Empty(remover.ItemFieldNames);
|
2020-12-18 23:06:28 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void PopulateExclusionHeaderFieldTest()
|
|
|
|
|
{
|
|
|
|
|
// Setup the list
|
2024-03-05 13:32:49 -05:00
|
|
|
List<string> exclusions =
|
|
|
|
|
[
|
2020-12-18 23:06:28 -08:00
|
|
|
"header.datname",
|
2024-03-05 13:32:49 -05:00
|
|
|
];
|
2020-12-18 23:06:28 -08:00
|
|
|
|
2021-02-01 12:11:32 -08:00
|
|
|
// Setup the remover
|
|
|
|
|
var remover = new Remover();
|
|
|
|
|
remover.PopulateExclusionsFromList(exclusions);
|
2020-12-18 23:06:28 -08:00
|
|
|
|
|
|
|
|
// Check the exclusion lists
|
2024-03-05 16:37:52 -05:00
|
|
|
Assert.Empty(remover.HeaderFieldNames);
|
|
|
|
|
Assert.Empty(remover.MachineFieldNames);
|
|
|
|
|
Assert.Empty(remover.ItemFieldNames);
|
2020-12-18 23:06:28 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void PopulateExclusionMachineFieldTest()
|
|
|
|
|
{
|
|
|
|
|
// Setup the list
|
2024-03-05 13:32:49 -05:00
|
|
|
List<string> exclusions =
|
|
|
|
|
[
|
2020-12-18 23:06:28 -08:00
|
|
|
"machine.name",
|
2024-03-05 13:32:49 -05:00
|
|
|
];
|
2020-12-18 23:06:28 -08:00
|
|
|
|
2021-02-01 12:11:32 -08:00
|
|
|
// Setup the remover
|
|
|
|
|
var remover = new Remover();
|
|
|
|
|
remover.PopulateExclusionsFromList(exclusions);
|
2020-12-18 23:06:28 -08:00
|
|
|
|
|
|
|
|
// Check the exclusion lists
|
2024-03-05 16:37:52 -05:00
|
|
|
Assert.Empty(remover.HeaderFieldNames);
|
|
|
|
|
Assert.Single(remover.MachineFieldNames);
|
|
|
|
|
Assert.Empty(remover.ItemFieldNames);
|
2020-12-18 23:06:28 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void PopulateExclusionDatItemFieldTest()
|
|
|
|
|
{
|
|
|
|
|
// Setup the list
|
2024-03-05 13:32:49 -05:00
|
|
|
List<string> exclusions =
|
|
|
|
|
[
|
2020-12-18 23:06:28 -08:00
|
|
|
"item.name",
|
2024-03-05 13:32:49 -05:00
|
|
|
];
|
2020-12-18 23:06:28 -08:00
|
|
|
|
2021-02-01 12:11:32 -08:00
|
|
|
// Setup the remover
|
|
|
|
|
var remover = new Remover();
|
|
|
|
|
remover.PopulateExclusionsFromList(exclusions);
|
2020-12-18 23:06:28 -08:00
|
|
|
|
|
|
|
|
// Check the exclusion lists
|
2024-03-05 16:37:52 -05:00
|
|
|
Assert.Empty(remover.HeaderFieldNames);
|
|
|
|
|
Assert.Empty(remover.MachineFieldNames);
|
|
|
|
|
Assert.Single(remover.ItemFieldNames);
|
2020-12-18 23:06:28 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|