Skip to content

Commit ad33377

Browse files
committed
Changed BerConverterTests.Decode_TestData to account for differing behaviour between Windows 7 and later versions.
This is intended to fix the Decode_Bytes_ReturnsExpected test.
1 parent c486b7e commit ad33377

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/libraries/System.DirectoryServices.Protocols/tests/BerConverterTests.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,10 @@ public static IEnumerable<object[]> Decode_TestData()
159159

160160
// Content: sequence containing three octet strings
161161
// Parsed as two sequences of octet strings
162-
yield return new object[] { "vv", new byte[] { 48, 132, 0, 0, 0, 9, 4, 3, 97, 98, 99, 4, 0, 4, 0 }, new object[] { new string[] { "abc", "" }, null } };
162+
// This is parsed differently between Windows 7 and later versions: the first element returned by Windows 7 will be an array of length 2,
163+
// while this will be an array of length 3 in later versions.
164+
yield return new object[] { "vv", new byte[] { 48, 132, 0, 0, 0, 9, 4, 3, 97, 98, 99, 4, 0, 4, 0 },
165+
Environment.OSVersion.Version <= new Version(6, 1) ? new object[] { new string[] { "abc", "" }, null } : new object[] { new string[] { "abc", "", "" }, null } };
163166

164167
// Content: sequence containing two sequences of octet strings
165168
// Parsed as such
@@ -179,7 +182,10 @@ public static IEnumerable<object[]> Decode_TestData()
179182

180183
// Content: sequence of octet strings
181184
// Parsed as two sequences of octet strings (returned as bytes)
182-
yield return new object[] { "VV", new byte[] { 48, 132, 0, 0, 0, 9, 4, 3, 97, 98, 99, 4, 0, 4, 0 }, new object[] { new byte[][] { [97, 98, 99], [] }, null } };
185+
// This is parsed differently between Windows 7 and later versions: the first element returned by Windows 7 will be an array of length 2,
186+
// while this will be an array of length 3 in later versions.
187+
yield return new object[] { "VV", new byte[] { 48, 132, 0, 0, 0, 9, 4, 3, 97, 98, 99, 4, 0, 4, 0 },
188+
Environment.OSVersion.Version <= new Version(6, 1) ? new object[] { new byte[][] { [97, 98, 99], [] }, null } : new object[]{ new byte[][] { [97, 98, 99], [], [] }, null } };
183189

184190
// Content: sequence containing two booleans
185191
// Parsed as a sequence containing two sequences of octet strings (returned as bytes)

0 commit comments

Comments
 (0)