FFMpegCore/FFMpegCore.Test/Utilities/WindowsOnlyTestMethod.cs

24 lines
715 B
C#
Raw Normal View History

2023-01-29 23:08:47 +01:00
using System.Runtime.InteropServices;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace FFMpegCore.Test.Utilities;
public class WindowsOnlyTestMethod : TestMethodAttribute
{
public override TestResult[] Execute(ITestMethod testMethod)
{
2023-01-29 23:10:24 +01:00
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
2023-01-29 23:08:47 +01:00
{
var message = $"Test not executed on other platforms than Windows";
{
return new[]
{
new TestResult { Outcome = UnitTestOutcome.Inconclusive, TestFailureException = new AssertInconclusiveException(message) }
};
}
}
2023-01-29 23:08:47 +01:00
return base.Execute(testMethod);
}
}