PlatformFactAttribute.cs 745 B

12345678910111213141516171819202122232425
  1. using System;
  2. using System.Linq;
  3. using System.Runtime.InteropServices;
  4. using Xunit;
  5. namespace Avalonia.IntegrationTests.Appium
  6. {
  7. internal class PlatformFactAttribute : FactAttribute
  8. {
  9. public override string? Skip
  10. {
  11. get
  12. {
  13. if (SkipOnWindows && RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
  14. return "Ignored on Windows";
  15. if (SkipOnOSX && RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
  16. return "Ignored on MacOS";
  17. return null;
  18. }
  19. set => throw new NotSupportedException();
  20. }
  21. public bool SkipOnOSX { get; set; }
  22. public bool SkipOnWindows { get; set; }
  23. }
  24. }