本文整理汇总了C#中Root.FetchChild方法的典型用法代码示例。如果您正苦于以下问题:C# Root.FetchChild方法的具体用法?C# Root.FetchChild怎么用?C# Root.FetchChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Root
的用法示例。
在下文中一共展示了Root.FetchChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FetchAndDeleteChild
public void FetchAndDeleteChild()
{
Root root = new Root();
root.FetchChild();
Assert.IsFalse(root.Child.IsNew, "Child should not be new");
Assert.IsFalse(root.Child.IsDirty, "Child should not be dirty");
Assert.AreEqual("Fetched", root.Child.Status, "Child status incorrect after fetch");
root.Child.DeleteChild();
Assert.IsTrue(root.Child.IsDeleted, "Child should be marked for deletion");
Assert.IsTrue(root.Child.IsDirty, "Child should be dirty");
root = root.Save();
Assert.IsTrue(root.IsDirty, "Root should be dirty after Save");
Assert.IsFalse(root.IsNew, "Root should not be new");
Assert.IsTrue(root.Child.IsDirty, "Child should be dirty after Save");
Assert.IsTrue(root.Child.IsNew, "Child should be new after Save");
Assert.AreEqual("Deleted", root.Child.Status, "Child status incorrect after Save");
}
示例2: FetchAndSaveChild
public void FetchAndSaveChild()
{
Root root = new Root();
root.FetchChild();
Assert.IsFalse(root.Child.IsNew, "Child should not be new");
Assert.IsFalse(root.Child.IsDirty, "Child should not be dirty");
Assert.AreEqual("Fetched", root.Child.Status, "Child status incorrect after fetch");
root.Child.Data = "b";
Assert.IsTrue(root.Child.IsDirty, "Child should be dirty");
root = root.Save();
Assert.IsFalse(root.IsDirty, "Root should not be dirty");
Assert.IsFalse(root.IsNew, "Root should not be new");
Assert.IsFalse(root.Child.IsDirty, "Child should not be dirty");
Assert.IsFalse(root.Child.IsNew, "Child should not be new");
Assert.AreEqual("Updated", root.Child.Status, "Child status incorrect after Save");
}