Exemplo n.º 1
0
        public void GivenEqualOrNotValue_MustEqualOrNot()
        {
            var constA = typeof(ValueBox).GetConstructor(Type.EmptyTypes);
            var constB = typeof(ValueBox).GetConstructor(new Type[] { typeof(int) });

            var a = new ConstructCompiled(constA);
            var b = new ConstructCompiled(constA);
            var c = new ConstructCompiled(constB);

            Assert.IsTrue(a.Equals(b));
            Assert.IsTrue(a.Equals((object)b));
            Assert.IsFalse(a.Equals(c));
            Assert.IsFalse(a.Equals((object)null));
            Assert.IsFalse(a.Equals(null));

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