Example #1
0
        public void test_cloning_on_extendables_with_simple_base()
        {
            SimpleObj s = new SimpleObj {
                p = "v"
            };
            ExtendableObj <SimpleObj> ex = ExtendableObj.Create(s);

            ex.AddString("p2", "v2");
            ExtendableObj <SimpleObj> cloned = Helpers.Clone(ex);

            Assert.AreNotEqual(ex, cloned);
            Assert.AreEqual(ex.GetValue("p"), cloned.GetValue("p"));
            Assert.AreEqual(ex.GetValue("p2"), cloned.GetValue("p2"));
        }
Example #2
0
        public void test_cloning_on_extendables_with_clonable_base()
        {
            CloneableObj c = new CloneableObj {
                p = 100
            };
            ExtendableObj <CloneableObj> ex = ExtendableObj.Create(c);

            ex.AddString("p2", "v2");
            ExtendableObj <CloneableObj> cloned = Helpers.Clone(ex);

            Assert.AreNotEqual(ex, cloned);
            Assert.AreEqual(100, ex.GetValue("p"));
            Assert.AreEqual(101, cloned.GetValue("p"));
            Assert.AreEqual(ex.GetValue("p2"), cloned.GetValue("p2"));
        }