@@ -15,26 +15,42 @@ namespace NUnit.Framework.Tests.Attributes
1515 public class OSPlatformTranslatorTests
1616 {
1717 [ TestCase ( "Windows" , ExpectedResult = "Win" ) ]
18- [ TestCase ( "Windows7.0" , ExpectedResult = "Windows7" ) ]
19- [ TestCase ( "Windows10.0" , ExpectedResult = "Windows10" ) ]
18+ [ TestCase ( "Windows7.0" , ExpectedResult = "Windows7,Windows8,Windows10,Windows11 " ) ]
19+ [ TestCase ( "Windows10.0" , ExpectedResult = "Windows10,Windows11 " ) ]
2020 [ TestCase ( "Windows11.0" , ExpectedResult = "Windows11" ) ]
2121 [ TestCase ( "Linux" , ExpectedResult = "Linux" ) ]
2222 [ TestCase ( "OSX" , ExpectedResult = "MacOsX" ) ]
2323 [ TestCase ( "MacOS" , ExpectedResult = "MacOsX" ) ]
2424 [ TestCase ( "Android" , ExpectedResult = "Android" ) ]
2525 public string TranslatePlatform ( string platformName )
2626 {
27- return OSPlatformTranslator . Translate ( platformName ) ;
27+ return string . Join ( "," , OSPlatformTranslator . Translate ( platformName ) ) ;
2828 }
2929
3030#if NET5_0_OR_GREATER
3131 [ Test ]
32- public void TranslateSupportedOSPlatformAttribute ( )
32+ public void TranslateSupportedOSPlatformAttributeWindows7 ( )
3333 {
3434 var supported = new SupportedOSPlatformAttribute ( "Windows7.0" ) ;
3535
3636 PlatformAttribute platform = TranslateIntoSinglePlatform ( supported ) ;
37- Assert . That ( platform . Include , Is . EqualTo ( "Windows7" ) , nameof ( platform . Include ) ) ;
37+ Assert . That ( platform . Include , Does . Contain ( "Windows7" ) , nameof ( platform . Include ) ) ;
38+ Assert . That ( platform . Include , Does . Contain ( "Windows8" ) , nameof ( platform . Include ) ) ;
39+ Assert . That ( platform . Include , Does . Contain ( "Windows10" ) , nameof ( platform . Include ) ) ;
40+ Assert . That ( platform . Include , Does . Contain ( "Windows11" ) , nameof ( platform . Include ) ) ;
41+ Assert . That ( platform . Exclude , Is . Null , nameof ( platform . Exclude ) ) ;
42+ }
43+
44+ [ Test ]
45+ public void TranslateSupportedOSPlatformAttributeWindows10 ( )
46+ {
47+ var supported = new SupportedOSPlatformAttribute ( "Windows10.0" ) ;
48+
49+ PlatformAttribute platform = TranslateIntoSinglePlatform ( supported ) ;
50+ Assert . That ( platform . Include , Does . Not . Contain ( "Windows7" ) , nameof ( platform . Include ) ) ;
51+ Assert . That ( platform . Include , Does . Not . Contain ( "Windows8" ) , nameof ( platform . Include ) ) ;
52+ Assert . That ( platform . Include , Does . Contain ( "Windows10" ) , nameof ( platform . Include ) ) ;
53+ Assert . That ( platform . Include , Does . Contain ( "Windows11" ) , nameof ( platform . Include ) ) ;
3854 Assert . That ( platform . Exclude , Is . Null , nameof ( platform . Exclude ) ) ;
3955 }
4056
@@ -56,7 +72,9 @@ public void TranslateMultipleOSPlatformAttributes()
5672 var osPlatforms = new OSPlatformAttribute [ ] { supported1 , supported2 } ;
5773
5874 PlatformAttribute platform = TranslateIntoSinglePlatform ( osPlatforms ) ;
59- Assert . That ( platform . Include , Is . EqualTo ( "Windows7,Linux" ) , nameof ( platform . Include ) ) ;
75+ Assert . That ( platform . Include , Does . Contain ( "Windows7" ) , nameof ( platform . Include ) ) ;
76+ Assert . That ( platform . Include , Does . Contain ( "Windows10" ) , nameof ( platform . Include ) ) ;
77+ Assert . That ( platform . Include , Does . Contain ( "Linux" ) , nameof ( platform . Include ) ) ;
6078 Assert . That ( platform . Exclude , Is . Null , nameof ( platform . Exclude ) ) ;
6179 }
6280
@@ -68,7 +86,9 @@ public void TranslateMixedOSPlatformAttributes()
6886 var unsupported = new UnsupportedOSPlatformAttribute ( "Android" ) ;
6987
7088 PlatformAttribute platform = TranslateIntoSinglePlatform ( supported1 , unsupported , supported2 ) ;
71- Assert . That ( platform . Include , Is . EqualTo ( "Windows7,Linux" ) , nameof ( platform . Include ) ) ;
89+ Assert . That ( platform . Include , Does . Contain ( "Windows7" ) , nameof ( platform . Include ) ) ;
90+ Assert . That ( platform . Include , Does . Contain ( "Windows10" ) , nameof ( platform . Include ) ) ;
91+ Assert . That ( platform . Include , Does . Contain ( "Linux" ) , nameof ( platform . Include ) ) ;
7292 Assert . That ( platform . Exclude , Is . EqualTo ( "Android" ) , nameof ( platform . Exclude ) ) ;
7393 }
7494
@@ -80,7 +100,8 @@ public void TranslateMixedPlatformAndOSPlatformAttributes()
80100 var sourcePlatform = new PlatformAttribute ( "Win" ) ;
81101
82102 PlatformAttribute platform = TranslateIntoSinglePlatform ( sourcePlatform , supported1 , supported2 ) ;
83- Assert . That ( platform . Include , Is . EqualTo ( "Win,Windows10" ) , nameof ( platform . Include ) ) ;
103+ Assert . That ( platform . Include , Does . Contain ( "Win" ) , nameof ( platform . Include ) ) ;
104+ Assert . That ( platform . Include , Does . Contain ( "Windows10" ) , nameof ( platform . Include ) ) ;
84105 Assert . That ( platform . Exclude , Is . Null , nameof ( platform . Exclude ) ) ;
85106 }
86107
0 commit comments