Beispiel #1
0
        [Test] public void test_cloning_on_icloneables()
        {
            var c = new CloneableObj {
                p = 100
            };
            var cloned = Helpers.Clone(c);

            Assert.AreEqual(100, c.p);
            Assert.AreEqual(101, cloned.p);
        }
Beispiel #2
0
        [Test] public void test_cloning_on_extendables_with_clonable_base()
        {
            var c = new CloneableObj {
                p = 100
            };
            var ex = ExtendableObj.Create(c);

            ex.AddString("p2", "v2");
            var 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"));
        }