private void TestParseVersion(string value, int major, int minor, int build, int revision, AssemblyIdentityParts expectedParts) { AssemblyIdentityParts actualParts; ulong actual; Assert.True(AssemblyIdentity.TryParseVersion(value, out actual, out actualParts)); Assert.Equal(expectedParts, actualParts); Version actualVersion = AssemblyIdentity.ToVersion(actual); Assert.Equal(new Version(major, minor, build, revision), actualVersion); // compare with fusion var fusionName = FusionAssemblyIdentity.ToAssemblyNameObject("Name, Version=" + value); Assert.NotNull(fusionName); AssemblyIdentityParts fusionParts = 0; var fusionVersion = FusionAssemblyIdentity.GetVersion(fusionName, out fusionParts); Assert.Equal(fusionVersion, actualVersion); // Test limitation: // When constructing INameObject with CANOF.PARSE_DISPLAY_NAME option, // the Version=* is treated as unspecified version. That's also done by TryParseDisplayName, // but outside of TryParseVersion, which we are testing here. if (value == "*") { Assert.Equal((AssemblyIdentityParts)0, fusionParts); } else { Assert.Equal(expectedParts, fusionParts); } }