mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-04-24 07:03:09 +00:00
Move some things around
This commit is contained in:
58
BinaryObjectScanner.Test/Data/FactoryTests.cs
Normal file
58
BinaryObjectScanner.Test/Data/FactoryTests.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Data;
|
||||
using BinaryObjectScanner.Interfaces;
|
||||
using SabreTools.Serialization.Wrappers;
|
||||
using Xunit;
|
||||
|
||||
namespace BinaryObjectScanner.Test.Data
|
||||
{
|
||||
public class FactoryTests
|
||||
{
|
||||
#region CreateDetectable
|
||||
|
||||
private static readonly List<WrapperType> _detectableTypes =
|
||||
[
|
||||
// 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
|
||||
WrapperType.LDSCRYPT,
|
||||
// WrapperType.N3DS,
|
||||
// WrapperType.Nitro,
|
||||
// WrapperType.PlayJAudioFile, // TODO: Create wrapper to reenable test
|
||||
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
|
||||
}
|
||||
}
|
||||
45
BinaryObjectScanner.Test/Data/ProtectionDictionaryTests.cs
Normal file
45
BinaryObjectScanner.Test/Data/ProtectionDictionaryTests.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System.Collections.Generic;
|
||||
using BinaryObjectScanner.Data;
|
||||
using Xunit;
|
||||
|
||||
namespace BinaryObjectScanner.Test.Data
|
||||
{
|
||||
public class ProtectionDictionaryTests
|
||||
{
|
||||
#region ProcessProtectionString
|
||||
|
||||
[Fact]
|
||||
public void ProcessProtectionString_Null_Empty()
|
||||
{
|
||||
string? protection = null;
|
||||
List<string> actual = ProtectionDictionary.ProcessProtectionString(protection);
|
||||
Assert.Empty(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ProcessProtectionString_Empty_Empty()
|
||||
{
|
||||
string? protection = string.Empty;
|
||||
List<string> actual = ProtectionDictionary.ProcessProtectionString(protection);
|
||||
Assert.Empty(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ProcessProtectionString_NoIndicator_Single()
|
||||
{
|
||||
string? protection = "item1";
|
||||
List<string> actual = ProtectionDictionary.ProcessProtectionString(protection);
|
||||
Assert.Single(actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ProcessProtectionString_Indicator_Multiple()
|
||||
{
|
||||
string? protection = "item1;item2";
|
||||
List<string> actual = ProtectionDictionary.ProcessProtectionString(protection);
|
||||
Assert.Equal(2, actual.Count);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user