Only run downloader tests on windows and linux since macos CI runs on arm which builds are not available for

This commit is contained in:
Malte Rosenbjerg 2025-10-17 15:01:00 +02:00
parent 3be446880a
commit d7fec62d2e
4 changed files with 17 additions and 19 deletions

View file

@ -1,13 +0,0 @@
namespace FFMpegCore.Extensions.Downloader.Enums;
public static class EnumExtensions
{
public static TEnum[] GetFlags<TEnum>(this TEnum input) where TEnum : Enum
{
return Enum.GetValues(input.GetType())
.Cast<Enum>()
.Where(input.HasFlag)
.Cast<TEnum>()
.ToArray();
}
}

View file

@ -2,9 +2,9 @@
namespace FFMpegCore.Extensions.Downloader.Extensions; namespace FFMpegCore.Extensions.Downloader.Extensions;
internal static class EnumExtensions public static class EnumExtensions
{ {
public static string GetDescription(this Enum enumValue) internal static string GetDescription(this Enum enumValue)
{ {
var field = enumValue.GetType().GetField(enumValue.ToString()); var field = enumValue.GetType().GetField(enumValue.ToString());
if (field == null) if (field == null)
@ -19,4 +19,13 @@ internal static class EnumExtensions
return enumValue.ToString(); return enumValue.ToString();
} }
public static TEnum[] GetFlags<TEnum>(this TEnum input) where TEnum : Enum
{
return Enum.GetValues(input.GetType())
.Cast<Enum>()
.Where(input.HasFlag)
.Cast<TEnum>()
.ToArray();
}
} }

View file

@ -10,7 +10,8 @@ public class DownloaderTests
[OsSpecificTestMethod(OsPlatforms.Windows | OsPlatforms.Linux)] [OsSpecificTestMethod(OsPlatforms.Windows | OsPlatforms.Linux)]
public async Task GetSpecificVersionTest() public async Task GetSpecificVersionTest()
{ {
var binaries = await FFMpegDownloader.DownloadFFMpegSuite(FFMpegVersions.V6_1); var options = new FFOptions { BinaryFolder = Path.GetTempPath() };
var binaries = await FFMpegDownloader.DownloadFFMpegSuite(FFMpegVersions.V6_1, options: options);
try try
{ {
Assert.HasCount(2, binaries); Assert.HasCount(2, binaries);
@ -21,10 +22,11 @@ public class DownloaderTests
} }
} }
[OsSpecificTestMethod(OsPlatforms.Windows | OsPlatforms.Linux)] [TestMethod]
public async Task GetAllLatestSuiteTest() public async Task GetAllLatestSuiteTest()
{ {
var binaries = await FFMpegDownloader.DownloadFFMpegSuite(); var options = new FFOptions { BinaryFolder = Path.GetTempPath() };
var binaries = await FFMpegDownloader.DownloadFFMpegSuite(options: options);
try try
{ {
Assert.HasCount(2, binaries); Assert.HasCount(2, binaries);

View file

@ -1,6 +1,6 @@
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using FFMpegCore.Extensions.Downloader.Enums; using FFMpegCore.Extensions.Downloader.Extensions;
namespace FFMpegCore.Test.Utilities; namespace FFMpegCore.Test.Utilities;