public void TestCloneAsChild() { IMLChild child = CreateChild(), clone = Serializer.DeepClone(child); CheckChild(child, clone); }
internal static void CheckChild(IMLChild original, IMLChild clone) { Assert.AreNotSame(original, clone); Assert.IsInstanceOfType(typeof(IMLChild), original, "Original type"); Assert.IsInstanceOfType(typeof(IMLChild), clone, "Clone type"); Assert.AreEqual(0, clone.RootProperty, "RootProperty"); // not serialized Assert.AreEqual(original.ParentProperty, clone.ParentProperty, "ParentProperty"); Assert.AreEqual(original.ChildProperty, clone.ChildProperty, "ChildProperty"); }
internal static void CheckChild(IMLChild original, IMLChild clone) { Assert.NotSame(original, clone); Assert.IsType <IMLChild>(original); //, "Original type"); Assert.IsType <IMLChild>(clone); //, "Clone type"); Assert.Equal(0, clone.RootProperty); //, "RootProperty"); // not serialized Assert.Equal(original.ParentProperty, clone.ParentProperty); //, "ParentProperty"); Assert.Equal(original.ChildProperty, clone.ChildProperty); //, "ChildProperty"); }