Пример #1
0
        public void CloneObject_StringsAreImmutableAndUntouced()
        {
            var original = new TestCloneObjectStringProperty()
            {
                Name = "Philip S Doctor"
            };
            var cloneOfOriginal = odDictionaryStringString.CloneObject <TestCloneObjectStringProperty>(original);

            Assert.IsFalse(original == cloneOfOriginal);
            Assert.IsTrue(cloneOfOriginal.Name == original.Name);
        }
Пример #2
0
        public void CloneObject_CloneChildObject()
        {
            var originalChild = new TestCloneObjectStringProperty()
            {
                Name = "Philip S Doctor"
            };
            var originalParent = new TestCloneObjectWithChildObject()
            {
                NameParent = "Parent Object", ChildObject = originalChild
            };
            var cloneOfOriginal = odDictionaryStringString.CloneObject <TestCloneObjectWithChildObject>(originalParent);

            Assert.IsFalse(originalParent == cloneOfOriginal);
            Assert.IsFalse(originalParent.ChildObject == cloneOfOriginal.ChildObject);
            Assert.IsTrue(cloneOfOriginal.ChildObject.Name == originalParent.ChildObject.Name);
            Assert.IsTrue(cloneOfOriginal.NameParent == originalParent.NameParent);
        }