예제 #1
0
        public void Equality_ReallyTheSame()
        {
            var a = new TypeShape
            {
                TypeHierarchy       = SomeTypeHierarchy,
                NestedTypes         = { Names.Type("T2,P") },
                Delegates           = { new DelegateTypeName() },
                EventHierarchies    = { new EventHierarchy() },
                Fields              = { new FieldName() },
                MethodHierarchies   = { new MethodHierarchy() },
                PropertyHierarchies = { new PropertyHierarchy() }
            };
            var b = new TypeShape
            {
                TypeHierarchy       = SomeTypeHierarchy,
                NestedTypes         = { Names.Type("T2,P") },
                Delegates           = { new DelegateTypeName() },
                EventHierarchies    = { new EventHierarchy() },
                Fields              = { new FieldName() },
                MethodHierarchies   = { new MethodHierarchy() },
                PropertyHierarchies = { new PropertyHierarchy() }
            };

            Assert.AreEqual(a, b);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }
예제 #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = 397;
         hashCode = (hashCode * 397) ^ TypeShape.GetHashCode();
         hashCode = (hashCode * 397) ^ SST.GetHashCode();
         return(hashCode);
     }
 }
예제 #3
0
        public void Equality_DifferentProperties()
        {
            var a = new TypeShape
            {
                PropertyHierarchies = { new PropertyHierarchy() }
            };
            var b = new TypeShape();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
예제 #4
0
        public void Equality_DifferentMethods()
        {
            var a = new TypeShape
            {
                MethodHierarchies = { new MethodHierarchy() }
            };
            var b = new TypeShape();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
예제 #5
0
        public void Equality_DifferentFields()
        {
            var a = new TypeShape
            {
                Fields = { new FieldName() }
            };
            var b = new TypeShape();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
예제 #6
0
        public void Equality_DifferentDelegates()
        {
            var a = new TypeShape
            {
                Delegates = { new DelegateTypeName() }
            };
            var b = new TypeShape();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
예제 #7
0
        public void Equality_DifferentNestedTypes()
        {
            var a = new TypeShape
            {
                NestedTypes = { Names.Type("T2,P") }
            };
            var b = new TypeShape();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
예제 #8
0
        public void Equality_DifferentType()
        {
            var a = new TypeShape
            {
                TypeHierarchy = SomeTypeHierarchy
            };
            var b = new TypeShape();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }