diff --git a/MPF.Test/RedumpLib/ExtensionsTests.cs b/MPF.Test/RedumpLib/ExtensionsTests.cs
index a969eaf4..829d8779 100644
--- a/MPF.Test/RedumpLib/ExtensionsTests.cs
+++ b/MPF.Test/RedumpLib/ExtensionsTests.cs
@@ -1,21 +1,141 @@
-using RedumpLib.Data;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using RedumpLib.Data;
using Xunit;
namespace MPF.Test.RedumpLib
{
public class ExtensionsTests
{
- [Theory]
- [InlineData(RedumpSystem.BandaiPippin, MediaType.CDROM)]
- [InlineData(RedumpSystem.MicrosoftXbox, MediaType.DVD)]
- [InlineData(RedumpSystem.NintendoGameCube, MediaType.NintendoGameCubeGameDisc)]
- [InlineData(RedumpSystem.NintendoWii, MediaType.NintendoWiiOpticalDisc)]
- [InlineData(RedumpSystem.NintendoWiiU, MediaType.NintendoWiiUOpticalDisc)]
- [InlineData(RedumpSystem.SonyPlayStationPortable, MediaType.UMD)]
- public void GetValidMediaTypesTest(RedumpSystem? knownSystem, MediaType? expected)
+ #region Cross-Enumeration
+
+ ///
+ /// DiscType values that map to MediaType
+ ///
+ private static readonly DiscType?[] _mappableDiscTypes = new DiscType?[]
{
- var actual = knownSystem.MediaTypes();
- Assert.Contains(expected, actual);
+ DiscType.BD25,
+ DiscType.BD50,
+ DiscType.CD,
+ DiscType.DVD5,
+ DiscType.DVD9,
+ DiscType.GDROM,
+ DiscType.HDDVDSL,
+ DiscType.NintendoGameCubeGameDisc,
+ DiscType.NintendoWiiOpticalDiscSL,
+ DiscType.NintendoWiiOpticalDiscDL,
+ DiscType.NintendoWiiUOpticalDiscSL,
+ DiscType.UMDSL,
+ DiscType.UMDDL,
+ };
+
+ ///
+ /// MediaType values that map to DiscType
+ ///
+ private static readonly MediaType?[] _mappableMediaTypes = new MediaType?[]
+ {
+ MediaType.BluRay,
+ MediaType.CDROM,
+ MediaType.DVD,
+ MediaType.GDROM,
+ MediaType.HDDVD,
+ MediaType.NintendoGameCubeGameDisc,
+ MediaType.NintendoWiiOpticalDisc,
+ MediaType.NintendoWiiUOpticalDisc,
+ MediaType.UMD,
+ };
+
+ ///
+ /// Check that every supported system has some set of MediaTypes supported
+ ///
+ /// RedumpSystem value to check
+ [Theory]
+ [MemberData(nameof(GenerateRedumpSystemTestData))]
+ public void MediaTypesTest(RedumpSystem? redumpSystem)
+ {
+ var actual = redumpSystem.MediaTypes();
+ Assert.NotEmpty(actual);
}
+
+ ///
+ /// Check that both mappable and unmappable media types output correctly
+ ///
+ /// MediaType value to check
+ /// True to expect a null mapping, false otherwise
+ [Theory]
+ [MemberData(nameof(GenerateMediaTypeTestData))]
+ public void ToDiscTypeTest(MediaType? mediaType, bool expectNull)
+ {
+ DiscType? actual = mediaType.ToDiscType();
+ Assert.Equal(expectNull, actual == null);
+ }
+
+ ///
+ /// Check that DiscType values all map to something appropriate
+ ///
+ /// DiscType value to check
+ /// True to expect a null mapping, false otherwise
+ [Theory]
+ [MemberData(nameof(GenerateDiscTypeTestData))]
+ public void ToMediaTypeTest(DiscType? discType, bool expectNull)
+ {
+ MediaType? actual = discType.ToMediaType();
+ Assert.Equal(expectNull, actual == null);
+ }
+
+ ///
+ /// Generate a test set of DiscType values
+ ///
+ /// MemberData-compatible list of DiscType values
+ public static List