Beispiel #1
0
        public void MemberInfoSlimEqualityComparer_NotImplemented()
        {
            var ts = new[]
            {
                MemberTypes.Custom,
                (MemberTypes)99,
            };

            var tq = new TypeSlimEqualityComparer();
            var eq = new MemberInfoSlimEqualityComparer(tq);

            foreach (var t in ts)
            {
                var m1 = new NotSupportedMemberInfoSlim(t);
                var m2 = new NotSupportedMemberInfoSlim(t);

                Assert.ThrowsException <NotImplementedException>(() => eq.GetHashCode(m1));
                Assert.ThrowsException <NotImplementedException>(() => eq.Equals(m1, m2));
            }
        }
Beispiel #2
0
        public void MemberInfoSlimEqualityComparer_NotSupported_Override()
        {
            var ts = new[]
            {
                MemberTypes.Custom,
                MemberTypes.Event,
                MemberTypes.NestedType,
                MemberTypes.TypeInfo,
                (MemberTypes)99,
            };

            var tq = new TypeSlimEqualityComparer();
            var eq = new MemberInfoSlimEqualityComparer(() => new NotSupportedOverride(tq));

            foreach (var t in ts)
            {
                var m1 = new NotSupportedMemberInfoSlim(t);
                var m2 = new NotSupportedMemberInfoSlim(t);

                Assert.AreEqual(42, eq.GetHashCode(m1));
                Assert.IsTrue(eq.Equals(m1, m2));
            }
        }