mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Remove unnecessary Create method and test
This commit is contained in:
@@ -176,55 +176,6 @@ namespace SabreTools.DatItems
|
||||
logger = new Logger(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a specific type of DatItem to be used based on an ItemType
|
||||
/// </summary>
|
||||
/// <param name="itemType">Type of the DatItem to be created</param>
|
||||
/// <returns>DatItem of the specific internal type that corresponds to the inputs</returns>
|
||||
public static DatItem Create(ItemType? itemType)
|
||||
{
|
||||
return itemType switch
|
||||
{
|
||||
ItemType.Adjuster => new Adjuster(),
|
||||
ItemType.Analog => new Analog(),
|
||||
ItemType.Archive => new Archive(),
|
||||
ItemType.BiosSet => new BiosSet(),
|
||||
ItemType.Blank => new Blank(),
|
||||
ItemType.Chip => new Chip(),
|
||||
ItemType.Condition => new Condition(),
|
||||
ItemType.Configuration => new Configuration(),
|
||||
ItemType.ConfLocation => new ConfLocation(),
|
||||
ItemType.Device => new Device(),
|
||||
ItemType.DeviceReference => new DeviceReference(),
|
||||
ItemType.DipLocation => new DipLocation(),
|
||||
ItemType.DipSwitch => new DipSwitch(),
|
||||
ItemType.Disk => new Disk(),
|
||||
ItemType.Display => new Display(),
|
||||
ItemType.Driver => new Driver(),
|
||||
ItemType.Extension => new Extension(),
|
||||
ItemType.Feature => new Feature(),
|
||||
ItemType.File => new Formats.File(),
|
||||
ItemType.Info => new Info(),
|
||||
ItemType.Instance => new Instance(),
|
||||
ItemType.Media => new Media(),
|
||||
ItemType.PartFeature => new PartFeature(),
|
||||
ItemType.Port => new Port(),
|
||||
ItemType.RamOption => new RamOption(),
|
||||
ItemType.Release => new Release(),
|
||||
ItemType.ReleaseDetails => new ReleaseDetails(),
|
||||
ItemType.Rom => new Rom(),
|
||||
ItemType.Sample => new Sample(),
|
||||
ItemType.Serials => new Serials(),
|
||||
ItemType.SharedFeature => new SharedFeature(),
|
||||
ItemType.Slot => new Slot(),
|
||||
ItemType.SlotOption => new SlotOption(),
|
||||
ItemType.SoftwareList => new SoftwareList(),
|
||||
ItemType.Sound => new Sound(),
|
||||
ItemType.SourceDetails => new SourceDetails(),
|
||||
_ => new Rom(),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a specific type of DatItem to be used based on a BaseFile
|
||||
/// </summary>
|
||||
|
||||
@@ -11,17 +11,6 @@ namespace SabreTools.Test.DatItems
|
||||
{
|
||||
public class DatItemTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(null, ItemType.Rom)]
|
||||
[InlineData(ItemType.Disk, ItemType.Disk)]
|
||||
[InlineData(ItemType.Media, ItemType.Media)]
|
||||
[InlineData(ItemType.Rom, ItemType.Rom)]
|
||||
public void CreateItemTypeTest(ItemType? itemType, ItemType expected)
|
||||
{
|
||||
var actual = DatItem.Create(itemType);
|
||||
Assert.Equal(expected, actual.GetFieldValue<ItemType>(Models.Metadata.DatItem.TypeKey));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(FileType.None, ItemType.Rom)]
|
||||
[InlineData(FileType.Folder, null)]
|
||||
|
||||
Reference in New Issue
Block a user