public void ParseFullIdentity() { var identity = AssemblyIdentity.Parse("Wheatech.Framework.Modulize, Version=4.5.1.0, Culture=zh-Hans, PublicKeyToken=31bf3856ad364e35"); Assert.NotNull(identity); Assert.Equal("Wheatech.Framework.Modulize", identity.ShortName); Assert.True(identity.PublicKeyToken.SequenceEqual(new byte[] { 0x31, 0xbf, 0x38, 0x56, 0xad, 0x36, 0x4e, 0x35 })); Assert.Equal(CultureInfo.GetCultureInfo("zh-Hans"), identity.Culture); Assert.Equal(Version.Parse("4.5.1.0"), identity.Version); }
public void ParseSpecifiedCulture() { var identity = AssemblyIdentity.Parse("Wheatech.Framework.Modulize, Culture=zh-Hans"); Assert.NotNull(identity); Assert.Equal("Wheatech.Framework.Modulize", identity.ShortName); Assert.Null(identity.Version); Assert.Equal(CultureInfo.GetCultureInfo("zh-Hans"), identity.Culture); Assert.Null(identity.PublicKeyToken); }
public void ParseNullPublicKeyToken() { var identity = AssemblyIdentity.Parse("Wheatech.Framework.Modulize, PublicKeyToken=null"); Assert.NotNull(identity); Assert.Equal("Wheatech.Framework.Modulize", identity.ShortName); Assert.Null(identity.Version); Assert.Null(identity.Culture); Assert.Null(identity.PublicKeyToken); }
public void ParseVersion() { var identity = AssemblyIdentity.Parse("Wheatech.Framework.Modulize, Version=4.5.1.0"); Assert.NotNull(identity); Assert.Equal("Wheatech.Framework.Modulize", identity.ShortName); Assert.Null(identity.Culture); Assert.Null(identity.PublicKeyToken); Assert.Equal(Version.Parse("4.5.1.0"), identity.Version); }
public void ParseSpecifiedPublicKeyToken() { var identity = AssemblyIdentity.Parse("Wheatech.Framework.Modulize, PublicKeyToken=31bf3856ad364e35"); Assert.NotNull(identity); Assert.Equal("Wheatech.Framework.Modulize", identity.ShortName); Assert.Null(identity.Version); Assert.Null(identity.Culture); Assert.NotNull(identity.PublicKeyToken); Assert.True(identity.PublicKeyToken.SequenceEqual(new byte[] { 0x31, 0xbf, 0x38, 0x56, 0xad, 0x36, 0x4e, 0x35 })); }
public void CompareVersion() { Assert.True( AssemblyIdentityComparer.Version.Equals( AssemblyIdentity.Parse("Wheatech.Framework.Modulize, Version=4.5.1.0, Culture=zh-Hans, PublicKeyToken=31bf3856ad364e35"), AssemblyIdentity.Parse("Wheatech.Framework.Modulize, Version=4.5.1.0"))); Assert.False(AssemblyIdentityComparer.Version.Equals( AssemblyIdentity.Parse("Wheatech.Framework.Modulize, Version=4.5.1.0, Culture=zh-Hans, PublicKeyToken=31bf3856ad364e35"), AssemblyIdentity.Parse("Wheatech.Framework.Modulize, Version=4.5.2.0"))); }
public void CompareDefault() { Assert.True( AssemblyIdentityComparer.Default.Equals( AssemblyIdentity.Parse("Wheatech.Framework.Modulize, Version=4.5.1.0, Culture=neutral, PublicKeyToken=null"), AssemblyIdentity.Parse("Wheatech.Framework.Modulize, Version=4.5.1.0"))); Assert.True( AssemblyIdentityComparer.Default.Equals( AssemblyIdentity.Parse("Wheatech.Framework.Modulize, Version=4.5.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"), AssemblyIdentity.Parse("Wheatech.Framework.Modulize, Version=4.5.1.0, PublicKeyToken=31bf3856ad364e35"))); Assert.False( AssemblyIdentityComparer.Default.Equals( AssemblyIdentity.Parse("Wheatech.Framework.Modulize, Version=4.5.1.0, Culture=zh-Hans, PublicKeyToken=31bf3856ad364e35"), AssemblyIdentity.Parse("Wheatech.Framework.Modulize, Version=4.5.1.0, Culture=zh-Hans, PublicKeyToken=31bf3856ad364e36"))); }
public void ParseInvalidPublicKeyToken(string token) { ExceptionAssert.Throws <ArgumentException>(() => AssemblyIdentity.Parse(string.Format("Wheatech.Framework.Modulize, PublicKeyToken={0}", token))); }
public void ParseNotFoundCulture() { ExceptionAssert.Throws <ArgumentException>(() => AssemblyIdentity.Parse("Wheatech.Framework.Modulize, Culture=zh-abc")); }
public void GenerateParseString(string assemblyString) { Assert.Equal(assemblyString, AssemblyIdentity.Parse(assemblyString).ToString()); }