mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
This is cleanup based on both new .NET functionality (in 6 and 7) as well as a ton of simplifications and things that were missed that were caught due to the cleanup.
46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using SabreTools.DatItems;
|
|
using SabreTools.DatItems.Formats;
|
|
using SabreTools.Filtering;
|
|
using Xunit;
|
|
|
|
namespace SabreTools.Test.Filtering
|
|
{
|
|
public class RemoverTests
|
|
{
|
|
[Fact]
|
|
public void RemoveFieldsDatItemTest()
|
|
{
|
|
var datItem = CreateDatItem();
|
|
var remover = new DatItemRemover();
|
|
remover.SetRemover("DatItem.Name");
|
|
remover.RemoveFields(datItem);
|
|
Assert.Null(datItem.GetName());
|
|
}
|
|
|
|
[Fact]
|
|
public void RemoveFieldsMachineTest()
|
|
{
|
|
var datItem = CreateDatItem();
|
|
var remover = new DatItemRemover();
|
|
remover.SetRemover("Machine.Name");
|
|
remover.RemoveFields(datItem);
|
|
Assert.Null(datItem.Machine.Name);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Generate a consistent DatItem for testing
|
|
/// </summary>
|
|
private static DatItem CreateDatItem()
|
|
{
|
|
return new Rom
|
|
{
|
|
Name = "foo",
|
|
Machine = new Machine
|
|
{
|
|
Name = "bar",
|
|
Description = "bar",
|
|
}
|
|
};
|
|
}
|
|
}
|
|
} |