Test Fix: Add IsSoundPlaySupported condition to skip on Nano (dotnet/corefx#34820)
authorMaryam Ariyan <maryam.ariyan@microsoft.com>
Fri, 25 Jan 2019 01:06:44 +0000 (17:06 -0800)
committerDan Moseley <danmose@microsoft.com>
Fri, 25 Jan 2019 01:06:44 +0000 (17:06 -0800)
* Test Fix: Add IsSoundPlaySupported condition to skip on Nano

Fixes: dotnet/corefx#34808

* Removed Helpers class

Commit migrated from https://github.com/dotnet/corefx/commit/dfb8fd883963de134fd09b54c61ac8da5ad573bf

src/libraries/CoreFx.Private.TestUtilities/ref/CoreFx.Private.TestUtilities.cs
src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Unix.cs
src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Windows.cs
src/libraries/System.Windows.Extensions/tests/System/Media/SoundPlayerTests.cs

index d741541..b030f0b 100644 (file)
@@ -91,6 +91,7 @@ namespace System
         public static bool IsNotRedHatFamily { get { throw null; } }
         public static bool IsRedHatFamily6 { get { throw null; } }
         public static bool IsRedHatFamily7 { get { throw null; } }
+        public static bool IsSoundPlaySupported { get { throw null; } }
         public static bool IsNotRedHatFamily6 { get { throw null; } }
         public static bool IsUap { get { throw null; } }
         public static Version ICUVersion { get { return null; } }
index 82a4405..f6c195a 100644 (file)
@@ -61,6 +61,7 @@ namespace System
         public static bool IsNetfx472OrNewer => false;
 
         public static bool IsDrawingSupported { get; } = GetGdiplusIsAvailable();
+        public static bool IsSoundPlaySupported { get; } = false;
 
         [DllImport("libdl")]
         private static extern IntPtr dlopen(string libName, int flags);
index dc25bd2..b0d678b 100644 (file)
@@ -17,6 +17,7 @@ namespace System
         public static Version OSXVersion => throw new PlatformNotSupportedException();
         public static Version OpenSslVersion => throw new PlatformNotSupportedException();
         public static bool IsDrawingSupported => IsNotWindowsNanoServer && IsNotWindowsServerCore;
+        public static bool IsSoundPlaySupported => IsNotWindowsNanoServer;
         public static bool IsSuperUser => throw new PlatformNotSupportedException();
         public static bool IsCentos6 => false;
         public static bool IsOpenSUSE => false;
index 12e8c2c..8c75ad9 100644 (file)
@@ -85,7 +85,7 @@ namespace System.Media.Test
             yield return new object[] { "ima.wav" };
         }
 
-        [Theory]
+        [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsSoundPlaySupported))] 
         [MemberData(nameof(Play_String_TestData))]
         [OuterLoop]
         public void Load_SourceLocation_Success(string sourceLocation)
@@ -100,7 +100,7 @@ namespace System.Media.Test
             soundPlayer.Play();
         }
 
-        [Theory]
+        [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsSoundPlaySupported))] 
         [MemberData(nameof(Play_String_TestData))]
         [OuterLoop]
         public async Task LoadAsync_SourceLocationFromNetwork_Success(string sourceLocation)
@@ -197,7 +197,7 @@ namespace System.Media.Test
             }
         }
 
-        [Theory]
+        [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsSoundPlaySupported))] 
         [MemberData(nameof(Play_String_TestData))]
         [OuterLoop]
         public void Play_SourceLocation_Success(string sourceLocation)
@@ -212,14 +212,14 @@ namespace System.Media.Test
             soundPlayer.Load();
         }
 
-        [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))]
+        [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsSoundPlaySupported))] 
         public void Play_NoSuchFile_ThrowsFileNotFoundException()
         {
             var soundPlayer = new SoundPlayer("noSuchFile");
             Assert.Throws<FileNotFoundException>(() => soundPlayer.Play());
         }
 
-        [Theory]
+        [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsSoundPlaySupported))] 
         [MemberData(nameof(Play_String_TestData))]
         [OuterLoop]
         public void Play_Stream_Success(string sourceLocation)
@@ -248,7 +248,7 @@ namespace System.Media.Test
             player.Play();
         }
 
-        [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))]
+        [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsSoundPlaySupported))]
         [MemberData(nameof(Play_InvalidString_TestData))]
         [InlineData("http://google.com")]
         public void Play_InvalidFile_ThrowsInvalidOperationException(string sourceLocation)