Ejemplo n.º 1
0
        public static void Test()
        {
            List <int>   x = new List <int>();
            IntegerList2 y = new IntegerList2();

            Assert.IsTrue(x.GetType() == typeof(List <int>));

            Type tx = typeof(List <int>);

            Assert.AreEqual(tx, typeof(List <int>));

            Type tx2 = typeof(List <int>);

            Assert.AreEqual(tx, tx2);

            Type tx3 = typeof(IntegerList2);

            Assert.AreNotEqual(tx, tx3);

            object tx2O = Activator.CreateInstance(tx2);

            Assert.IsInstanceOfType(tx2O, tx2);

            object tx3O = Activator.CreateInstance(tx3);

            Assert.IsInstanceOfType(tx3O, tx3);

            if (x is List <int> il)
            {
                Assert.IsTrue(il != null);
            }

            if (x is List <int> il2)
            {
                Assert.IsTrue(il2 != null);
            }

            if (y is List <int> il3)
            {
                Assert.IsTrue(il3 != null);
            }


            MyType2.Test2();

            MyType3.Test3();
        }
Ejemplo n.º 2
0
        public void MappingWithInterfaceToParentInterface()
        {
            var source = new MyType3()
            {
                Interface = new IB3()
                {
                    MyProperty = 1
                }
            };

            var ultraMapper = new Mapper();
            var target      = ultraMapper.Map <MyType>(source);

            bool isResultOk = ultraMapper.VerifyMapperResult(source, target);

            Assert.IsTrue(isResultOk);
            Assert.IsTrue(!Object.ReferenceEquals(source.Interface, target.Interface));
        }