diff --git a/tests/Avalonia.IntegrationTests.Appium/PlatformFactAttribute.cs b/tests/Avalonia.IntegrationTests.Appium/PlatformFactAttribute.cs index 3acf9fd5e2..17c42216e9 100644 --- a/tests/Avalonia.IntegrationTests.Appium/PlatformFactAttribute.cs +++ b/tests/Avalonia.IntegrationTests.Appium/PlatformFactAttribute.cs @@ -17,6 +17,7 @@ namespace Avalonia internal class PlatformFactAttribute : FactAttribute { private readonly string? _reason; + private string? _skip; public PlatformFactAttribute(TestPlatforms platforms, string? reason = null) { @@ -28,8 +29,16 @@ namespace Avalonia public override string? Skip { - get => IsSupported() ? null : $"Ignored on {RuntimeInformation.OSDescription}" + (_reason is not null ? $" reason: \"{_reason}\"" : ""); - set => throw new NotSupportedException(); + get + { + if (_skip is not null) + return _skip; + if (!IsSupported()) + return $"Ignored on {RuntimeInformation.OSDescription}" + + (_reason is not null ? $" reason: '{_reason}'" : ""); + return null; + } + set => _skip = value; } private bool IsSupported() diff --git a/tests/Avalonia.IntegrationTests.Appium/PlatformTheoryAttribute.cs b/tests/Avalonia.IntegrationTests.Appium/PlatformTheoryAttribute.cs index 7ac30ee11b..46a8e1af98 100644 --- a/tests/Avalonia.IntegrationTests.Appium/PlatformTheoryAttribute.cs +++ b/tests/Avalonia.IntegrationTests.Appium/PlatformTheoryAttribute.cs @@ -7,14 +7,21 @@ namespace Avalonia.IntegrationTests.Appium { internal class PlatformTheoryAttribute : TheoryAttribute { + private string? _skip; + public PlatformTheoryAttribute(TestPlatforms platforms = TestPlatforms.All) => Platforms = platforms; public TestPlatforms Platforms { get; } public override string? Skip { - get => IsSupported() ? null : $"Ignored on {RuntimeInformation.OSDescription}"; - set => throw new NotSupportedException(); + get + { + if (_skip is not null) + return _skip; + return !IsSupported() ? $"Ignored on {RuntimeInformation.OSDescription}" : null; + } + set => _skip = value; } private bool IsSupported()