Files
SabreTools/SabreTools.Test/PopulationTests.cs

98 lines
2.7 KiB
C#
Raw Normal View History

2020-12-18 23:06:28 -08:00
using System.Collections.Generic;
2024-10-30 11:26:56 -04:00
using SabreTools.DatTools;
2020-12-18 23:06:28 -08:00
using Xunit;
namespace SabreTools.Test
2020-12-18 23:06:28 -08:00
{
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
// 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
// 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
// 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
// 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
// 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
}
}
}