コード例 #1
0
        private void Run(Type[] types, object[] values)
        {
            var construct = typeof(ValueBox).GetConstructor(types);
            var c         = new ConstructCompiled(construct);

            Assert.AreEqual(construct, c.Constructor);
            var val = c.Creator(values);

            Assert.IsNotNull(val, "arg count" + values.Length);
        }
コード例 #2
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());
        }