Ejemplo n.º 1
0
        public unsafe void SameMemberwiseComparable_EqualWithSelf()
        {
            int someNumber = 1;
            var a          = new MemberwiseComparable();

            a.PublicInt = &someNumber;

            Assert.True(a.Equals(a));
        }
Ejemplo n.º 2
0
        public unsafe void UnequalMemberwiseComparables_AreUnequal()
        {
            int someNumber = 1;
            var a          = new MemberwiseComparable();

            a.PublicInt = &someNumber;
            var b = new MemberwiseComparable();

            Assert.False(a.Equals(b));
        }
Ejemplo n.º 3
0
        public unsafe void EqualMemberwiseComparables_AreEqual()
        {
            int someNumber = 1;
            var a          = new MemberwiseComparable();

            a.PublicInt = &someNumber;
            MemberwiseComparable b = a;

            Assert.True(a.Equals(b));
            Assert.Equal(a.GetHashCode(), b.GetHashCode());
        }