33// See the LICENSE file in the project root for more information.
44
55using System . Collections . Generic ;
6+ using System . Runtime . InteropServices ;
67using Xunit ;
78
89namespace System . DirectoryServices . Protocols . Tests
910{
10- [ ConditionalClass ( typeof ( PlatformDetection ) , nameof ( PlatformDetection . IsOpenSUSE ) ) ]
11+ [ ConditionalClass ( typeof ( DirectoryServicesTestHelpers ) , nameof ( DirectoryServicesTestHelpers . IsWindowsOrLibLdapIsInstalled ) ) ]
1112 public class DirSyncRequestControlTests
1213 {
1314 [ Fact ]
@@ -22,15 +23,15 @@ public void Ctor_Default()
2223 Assert . True ( control . ServerSide ) ;
2324 Assert . Equal ( "1.2.840.113556.1.4.841" , control . Type ) ;
2425
25- var expected = ( PlatformDetection . IsWindows ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } : new byte [ ] { 48 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } ;
26+ var expected = ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } : new byte [ ] { 48 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } ;
2627 Assert . Equal ( expected , control . GetValue ( ) ) ;
2728 }
2829
2930 public static IEnumerable < object [ ] > Ctor_Cookie_Data ( )
3031 {
31- yield return new object [ ] { null , ( PlatformDetection . IsWindows ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } : new byte [ ] { 48 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } } ;
32- yield return new object [ ] { new byte [ 0 ] , ( PlatformDetection . IsWindows ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } : new byte [ ] { 48 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } } ;
33- yield return new object [ ] { new byte [ ] { 97 , 98 , 99 } , ( PlatformDetection . IsWindows ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 13 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 3 , 97 , 98 , 99 } : new byte [ ] { 48 , 13 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 3 , 97 , 98 , 99 } } ;
32+ yield return new object [ ] { null , ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } : new byte [ ] { 48 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } } ;
33+ yield return new object [ ] { new byte [ 0 ] , ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } : new byte [ ] { 48 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } } ;
34+ yield return new object [ ] { new byte [ ] { 97 , 98 , 99 } , ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 13 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 3 , 97 , 98 , 99 } : new byte [ ] { 48 , 13 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 3 , 97 , 98 , 99 } } ;
3435 }
3536
3637 [ Theory ]
@@ -51,9 +52,9 @@ public void Ctor_Cookie(byte[] cookie, byte[] expectedValue)
5152
5253 public static IEnumerable < object [ ] > Ctor_Cookie_Options_Data ( )
5354 {
54- yield return new object [ ] { null , DirectorySynchronizationOptions . None , ( PlatformDetection . IsWindows ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } : new byte [ ] { 48 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } } ;
55- yield return new object [ ] { new byte [ 0 ] , DirectorySynchronizationOptions . None - 1 , ( PlatformDetection . IsWindows ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 13 , 2 , 4 , 255 , 255 , 255 , 255 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } : new byte [ ] { 48 , 10 , 2 , 1 , 255 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } } ;
56- yield return new object [ ] { new byte [ ] { 97 , 98 , 99 } , DirectorySynchronizationOptions . ObjectSecurity , ( PlatformDetection . IsWindows ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 13 , 2 , 1 , 1 , 2 , 3 , 16 , 0 , 0 , 4 , 3 , 97 , 98 , 99 } : new byte [ ] { 48 , 13 , 2 , 1 , 1 , 2 , 3 , 16 , 0 , 0 , 4 , 3 , 97 , 98 , 99 } } ;
55+ yield return new object [ ] { null , DirectorySynchronizationOptions . None , ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } : new byte [ ] { 48 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } } ;
56+ yield return new object [ ] { new byte [ 0 ] , DirectorySynchronizationOptions . None - 1 , ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 13 , 2 , 4 , 255 , 255 , 255 , 255 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } : new byte [ ] { 48 , 10 , 2 , 1 , 255 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } } ;
57+ yield return new object [ ] { new byte [ ] { 97 , 98 , 99 } , DirectorySynchronizationOptions . ObjectSecurity , ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 13 , 2 , 1 , 1 , 2 , 3 , 16 , 0 , 0 , 4 , 3 , 97 , 98 , 99 } : new byte [ ] { 48 , 13 , 2 , 1 , 1 , 2 , 3 , 16 , 0 , 0 , 4 , 3 , 97 , 98 , 99 } } ;
5758 }
5859
5960 [ Theory ]
@@ -74,9 +75,9 @@ public void Ctor_Cookie_Options(byte[] cookie, DirectorySynchronizationOptions o
7475
7576 public static IEnumerable < object [ ] > Ctor_Cookie_Options_AttributeCount_Data ( )
7677 {
77- yield return new object [ ] { null , DirectorySynchronizationOptions . None , 1048576 , ( PlatformDetection . IsWindows ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } : new byte [ ] { 48 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } } ;
78- yield return new object [ ] { new byte [ 0 ] , DirectorySynchronizationOptions . None - 1 , 0 , ( PlatformDetection . IsWindows ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 11 , 2 , 4 , 255 , 255 , 255 , 255 , 2 , 1 , 0 , 4 , 0 } : new byte [ ] { 48 , 8 , 2 , 1 , 255 , 2 , 1 , 0 , 4 , 0 } } ;
79- yield return new object [ ] { new byte [ ] { 97 , 98 , 99 } , DirectorySynchronizationOptions . ObjectSecurity , 10 , ( PlatformDetection . IsWindows ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 11 , 2 , 1 , 1 , 2 , 1 , 10 , 4 , 3 , 97 , 98 , 99 } : new byte [ ] { 48 , 11 , 2 , 1 , 1 , 2 , 1 , 10 , 4 , 3 , 97 , 98 , 99 } } ;
78+ yield return new object [ ] { null , DirectorySynchronizationOptions . None , 1048576 , ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } : new byte [ ] { 48 , 10 , 2 , 1 , 0 , 2 , 3 , 16 , 0 , 0 , 4 , 0 } } ;
79+ yield return new object [ ] { new byte [ 0 ] , DirectorySynchronizationOptions . None - 1 , 0 , ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 11 , 2 , 4 , 255 , 255 , 255 , 255 , 2 , 1 , 0 , 4 , 0 } : new byte [ ] { 48 , 8 , 2 , 1 , 255 , 2 , 1 , 0 , 4 , 0 } } ;
80+ yield return new object [ ] { new byte [ ] { 97 , 98 , 99 } , DirectorySynchronizationOptions . ObjectSecurity , 10 , ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ) ? new byte [ ] { 48 , 132 , 0 , 0 , 0 , 11 , 2 , 1 , 1 , 2 , 1 , 10 , 4 , 3 , 97 , 98 , 99 } : new byte [ ] { 48 , 11 , 2 , 1 , 1 , 2 , 1 , 10 , 4 , 3 , 97 , 98 , 99 } } ;
8081 }
8182
8283 [ Theory ]
0 commit comments