Files
BinaryObjectScanner/BinaryObjectScanner.Test/Data/FactoryTests.cs

58 lines
1.8 KiB
C#
Raw Normal View History

2024-12-01 23:50:19 -05:00
using System;
using System.Collections.Generic;
2025-09-06 12:40:06 -04:00
using BinaryObjectScanner.Data;
2024-12-01 23:50:19 -05:00
using BinaryObjectScanner.Interfaces;
using SabreTools.Serialization.Wrappers;
using Xunit;
2025-09-06 12:40:06 -04:00
namespace BinaryObjectScanner.Test.Data
2024-12-01 23:50:19 -05:00
{
public class FactoryTests
{
#region CreateDetectable
private static readonly List<WrapperType> _detectableTypes =
[
2025-09-06 10:40:26 -04:00
// WrapperType.AACSMediaKeyBlock, // TODO: Create wrapper to reenable test
// WrapperType.BDPlusSVM, // TODO: Create wrapper to reenable test
// WrapperType.CIA,
// WrapperType.Executable, // TODO: This needs to be split internally
2024-12-01 23:50:19 -05:00
WrapperType.LDSCRYPT,
2025-09-06 10:40:26 -04:00
// WrapperType.N3DS,
// WrapperType.Nitro,
// WrapperType.PlayJAudioFile, // TODO: Create wrapper to reenable test
2024-12-01 23:50:19 -05:00
WrapperType.RealArcadeInstaller,
WrapperType.RealArcadeMezzanine,
WrapperType.SFFS,
WrapperType.Textfile,
];
[Theory]
[MemberData(nameof(GenerateIDetectableTestData))]
public void CreateDetectableTests(WrapperType type, bool expectNull)
{
IDetectable? actual = Factory.CreateDetectable(type);
if (expectNull)
Assert.Null(actual);
else
Assert.NotNull(actual);
}
public static List<object?[]> GenerateIDetectableTestData()
{
var testData = new List<object?[]>() { new object?[] { null, true } };
foreach (WrapperType type in Enum.GetValues(typeof(WrapperType)))
{
if (_detectableTypes.Contains(type))
testData.Add([type, false]);
else
testData.Add([type, true]);
}
return testData;
}
#endregion
}
}