public void InvalidPublicKeyToken(string publicKeyToken)
 {
     Assert.Throws <PortabilityAnalyzerException>(() => _assemblyFilter.IsFrameworkAssembly(string.Empty, PublicKeyToken.Parse(publicKeyToken)));
 }
示例#2
0
        public static void EqualityTests()
        {
            var assemblyInfo1 = new AssemblyReferenceInformation("name", Version.Parse("4.0"), "neutral", PublicKeyToken.Parse("1234"));
            var assemblyInfo2 = new AssemblyReferenceInformation("Name", Version.Parse("4.0"), "neutral", PublicKeyToken.Parse("1234"));
            var assemblyInfo3 = new AssemblyReferenceInformation("name2", Version.Parse("4.0"), "neutral", PublicKeyToken.Parse("1234"));

            Assert.Equal($"name, Version=4.0, Culture=neutral, PublicKeyToken=1234", assemblyInfo1.ToString());
            Assert.Equal($"Name, Version=4.0, Culture=neutral, PublicKeyToken=1234", assemblyInfo2.ToString());
            Assert.Equal($"name2, Version=4.0, Culture=neutral, PublicKeyToken=1234", assemblyInfo3.ToString());

            Assert.True(assemblyInfo1.Equals(assemblyInfo2));
            Assert.False(assemblyInfo1.Equals(assemblyInfo3));
            Assert.False(assemblyInfo2.Equals(assemblyInfo3));

            Assert.Equal(assemblyInfo1.GetHashCode(), assemblyInfo2.GetHashCode());
            Assert.NotEqual(assemblyInfo1.GetHashCode(), assemblyInfo3.GetHashCode());
            Assert.NotEqual(assemblyInfo2.GetHashCode(), assemblyInfo3.GetHashCode());
        }
 public void DotNetFrameworkFilterCheckPublicKeyToken(string publicKeyToken, bool succeed)
 {
     Assert.Equal(succeed, _assemblyFilter.IsFrameworkAssembly(string.Empty, PublicKeyToken.Parse(publicKeyToken)));
 }