예제 #1
0
        public bool Equals(Packaging.PackageReference x, Packaging.PackageReference y)
        {
            if (ReferenceEquals(x, y))
            {
                return(true);
            }

            return(_packageIdentityComparer.Equals(x.PackageIdentity, y.PackageIdentity));
        }
예제 #2
0
 public bool Equals(PackageReference x, PackageReference y)
 {
     return(_packageIdentityComparer.Equals(x.PackageIdentity, y.PackageIdentity));
 }
예제 #3
0
        public void PackageIdentityComparer_Equals()
        {
            // Test equals is Reflexive
            Assert.True(comp.Equals(A100, A100));

            // Test equals is symmetric
            Assert.True(comp.Equals(A100, A100DUP));
            Assert.True(comp.Equals(A100DUP, A100));

            //Test equals is transitive
            Assert.False(comp.Equals(A100, null));
            Assert.False(comp.Equals(A100DUP, null));
            Assert.True(comp.Equals(A100, A100DUP));
            Assert.True(comp.Equals(A100DUP2, A100DUP));
            Assert.True(comp.Equals(A100DUP2, A100));

            // Test equals for null references
            Assert.False(comp.Equals(A100, null));
            Assert.False(comp.Equals(B100, null));


            // Run all tests again to check for consistency
            // Test equals is Reflexive
            Assert.True(comp.Equals(A100, A100));

            // Test equals is symmetric
            Assert.True(comp.Equals(A100, A100DUP));
            Assert.True(comp.Equals(A100DUP, A100));

            //Test equals is transitive
            Assert.False(comp.Equals(A100, null));
            Assert.False(comp.Equals(A100DUP, null));
            Assert.True(comp.Equals(A100, A100DUP));
            Assert.True(comp.Equals(A100DUP2, A100DUP));
            Assert.True(comp.Equals(A100DUP2, A100));

            // Test equals for null references
            Assert.False(comp.Equals(A100, null));
            Assert.False(comp.Equals(B100, null));
        }