using System;
using System.Collections.Generic;
using System.Linq;
using MPF.Core.Utilities;
using SabreTools.RedumpLib.Data;
using Xunit;
namespace MPF.Test.Core.Utilities
{
public class EnumExtensionsTests
{
///
/// MediaType values that support drive speeds
///
private static readonly MediaType?[] _supportDriveSpeeds = new MediaType?[]
{
MediaType.CDROM,
MediaType.DVD,
MediaType.GDROM,
MediaType.HDDVD,
MediaType.BluRay,
MediaType.NintendoGameCubeGameDisc,
MediaType.NintendoWiiOpticalDisc,
};
///
/// RedumpSystem values that are considered Audio
///
private static readonly RedumpSystem?[] _audioSystems = new RedumpSystem?[]
{
RedumpSystem.AtariJaguarCDInteractiveMultimediaSystem,
RedumpSystem.AudioCD,
RedumpSystem.DVDAudio,
RedumpSystem.HasbroiONEducationalGamingSystem,
RedumpSystem.HasbroVideoNow,
RedumpSystem.HasbroVideoNowColor,
RedumpSystem.HasbroVideoNowJr,
RedumpSystem.HasbroVideoNowXP,
RedumpSystem.PhilipsCDi,
RedumpSystem.SuperAudioCD,
};
///
/// RedumpSystem values that are considered markers
///
private static readonly RedumpSystem?[] _markerSystems = new RedumpSystem?[]
{
RedumpSystem.MarkerArcadeEnd,
RedumpSystem.MarkerComputerEnd,
RedumpSystem.MarkerDiscBasedConsoleEnd,
RedumpSystem.MarkerOtherEnd,
};
///
/// RedumpSystem values that are have reversed ringcodes
///
private static readonly RedumpSystem?[] _reverseRingcodeSystems = new RedumpSystem?[]
{
RedumpSystem.SonyPlayStation2,
RedumpSystem.SonyPlayStation3,
RedumpSystem.SonyPlayStation4,
RedumpSystem.SonyPlayStationPortable,
};
///
/// RedumpSystem values that are considered XGD
///
private static readonly RedumpSystem?[] _xgdSystems = new RedumpSystem?[]
{
RedumpSystem.MicrosoftXbox,
RedumpSystem.MicrosoftXbox360,
RedumpSystem.MicrosoftXboxOne,
RedumpSystem.MicrosoftXboxSeriesXS,
};
///
/// Check that all optical media support drive speeds
///
/// DriveType value to check
/// The expected value to come from the check
[Theory]
[MemberData(nameof(GenerateSupportDriveSpeedsTestData))]
public void DoesSupportDriveSpeedTest(MediaType? mediaType, bool expected)
{
bool actual = mediaType.DoesSupportDriveSpeed();
Assert.Equal(expected, actual);
}
///
/// Check that all systems with reversed ringcodes are marked properly
///
/// RedumpSystem value to check
/// The expected value to come from the check
[Theory]
[MemberData(nameof(GenerateReversedRingcodeSystemsTestData))]
public void HasReversedRingcodesTest(RedumpSystem? redumpSystem, bool expected)
{
bool actual = redumpSystem.HasReversedRingcodes();
Assert.Equal(expected, actual);
}
///
/// Check that all audio systems are marked properly
///
/// RedumpSystem value to check
/// The expected value to come from the check
[Theory]
[MemberData(nameof(GenerateAudioSystemsTestData))]
public void IsAudioTest(RedumpSystem? redumpSystem, bool expected)
{
bool actual = redumpSystem.IsAudio();
Assert.Equal(expected, actual);
}
///
/// Check that all marker systems are marked properly
///
/// RedumpSystem value to check
/// The expected value to come from the check
[Theory]
[MemberData(nameof(GenerateMarkerSystemsTestData))]
public void IsMarkerTest(RedumpSystem? redumpSystem, bool expected)
{
bool actual = redumpSystem.IsMarker();
Assert.Equal(expected, actual);
}
///
/// Check that all XGD systems are marked properly
///
/// RedumpSystem value to check
/// The expected value to come from the check
[Theory]
[MemberData(nameof(GenerateXGDSystemsTestData))]
public void IsXGDTest(RedumpSystem? redumpSystem, bool expected)
{
bool actual = redumpSystem.IsXGD();
Assert.Equal(expected, actual);
}
///
/// Generate a test set of MediaType values that support drive speeds
///
/// MemberData-compatible list of MediaType values
public static List