Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit f9dc783

Browse files
sepidehkhstephentoub
authored andcommitted
Update AssemblyName.FullName tests
1 parent 6e9eefa commit f9dc783

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

src/System.Reflection/tests/AssemblyNameTests.cs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,17 +251,40 @@ public void Name_CurrentlyExecutingAssembly()
251251
Assert.StartsWith("System.Reflection.Tests", assemblyName.Name);
252252
}
253253

254+
// The ECMA replacement key for the Microsoft implementation of the CLR.
255+
private static readonly byte[] TheKey =
256+
{
257+
0x00,0x24,0x00,0x00,0x04,0x80,0x00,0x00,0x94,0x00,0x00,0x00,0x06,0x02,0x00,0x00,
258+
0x00,0x24,0x00,0x00,0x52,0x53,0x41,0x31,0x00,0x04,0x00,0x00,0x01,0x00,0x01,0x00,
259+
0x07,0xd1,0xfa,0x57,0xc4,0xae,0xd9,0xf0,0xa3,0x2e,0x84,0xaa,0x0f,0xae,0xfd,0x0d,
260+
0xe9,0xe8,0xfd,0x6a,0xec,0x8f,0x87,0xfb,0x03,0x76,0x6c,0x83,0x4c,0x99,0x92,0x1e,
261+
0xb2,0x3b,0xe7,0x9a,0xd9,0xd5,0xdc,0xc1,0xdd,0x9a,0xd2,0x36,0x13,0x21,0x02,0x90,
262+
0x0b,0x72,0x3c,0xf9,0x80,0x95,0x7f,0xc4,0xe1,0x77,0x10,0x8f,0xc6,0x07,0x77,0x4f,
263+
0x29,0xe8,0x32,0x0e,0x92,0xea,0x05,0xec,0xe4,0xe8,0x21,0xc0,0xa5,0xef,0xe8,0xf1,
264+
0x64,0x5c,0x4c,0x0c,0x93,0xc1,0xab,0x99,0x28,0x5d,0x62,0x2c,0xaa,0x65,0x2c,0x1d,
265+
0xfa,0xd6,0x3d,0x74,0x5d,0x6f,0x2d,0xe5,0xf1,0x7e,0x5e,0xaf,0x0f,0xc4,0x96,0x3d,
266+
0x26,0x1c,0x8a,0x12,0x43,0x65,0x18,0x20,0x6d,0xc0,0x93,0x34,0x4d,0x5a,0xd2,0x93
267+
};
268+
269+
[Fact]
270+
public static void FullName_WithPublicKey()
271+
{
272+
AssemblyName assemblyName = new AssemblyName("MyAssemblyName, Version=1.0.0.0");
273+
assemblyName.SetPublicKey(TheKey);
274+
Assert.Equal("MyAssemblyName, Version=1.0.0.0, PublicKeyToken=b03f5f7f11d50a3a", assemblyName.FullName);
275+
}
276+
254277
public static IEnumerable<object[]> Version_TestData()
255278
{
256-
yield return new object[] { new Version(255, 1), "255.1.65535.65535" };
257-
yield return new object[] { new Version(255, 1, 2), "255.1.2.65535" };
279+
yield return new object[] { new Version(255, 1), "255.1" };
280+
yield return new object[] { new Version(255, 1, 2), "255.1.2" };
258281
yield return new object[] { new Version(255, 1, 2, 3), "255.1.2.3" };
282+
yield return new object[] { new Version(1, 2, 0x1ffff, 4), "1.2" };
259283
}
260284

261285
[ActiveIssue(19179)]
262286
[Theory]
263287
[MemberData(nameof(Version_TestData))]
264-
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "dotnet/corefx #19179")]
265288
public void Version(Version version, string versionString)
266289
{
267290
AssemblyName assemblyName = new AssemblyName("MyAssemblyName");

0 commit comments

Comments
 (0)