本文整理汇总了C#中Root.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Root.Save方法的具体用法?C# Root.Save怎么用?C# Root.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Root
的用法示例。
在下文中一共展示了Root.Save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAndDeleteChild
public void CreateAndDeleteChild()
{
Root root = new Root();
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");
Assert.IsTrue(root.Child.IsNew, "Child should be new");
Assert.AreEqual("Created", root.Child.Status, "Child status incorrect");
}
示例2: CreateAndSaveChild
public void CreateAndSaveChild()
{
Root root = new Root();
root.Data = "a";
root.Child.Data = "b";
Assert.IsTrue(root.IsDirty, "Root should be dirty");
Assert.IsTrue(root.Child.IsNew, "Child should be new");
Assert.IsTrue(root.Child.IsDirty, "Child should be dirty");
Assert.AreEqual("Created", root.Child.Status, "Child status incorrect after create");
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("Inserted", root.Child.Status, "Child status incorrect after Save");
}
示例3: 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");
}
示例4: FetchAndSaveChildListVerifyParent
public void FetchAndSaveChildListVerifyParent()
{
Root root = new Root();
root.Data = "root";
var oneChild = root.Child;
oneChild.Data = "random";
var list = root.ChildList;
Assert.IsFalse(root.ChildList.IsDirty, "Child list should not be dirty");
Assert.AreEqual("Fetched", root.ChildList.Status, "Child list status incorrect after fetch");
list.Add(Child.NewChild());
Assert.IsTrue(root.ChildList.IsDirty, "Child list should be dirty after add");
Assert.IsTrue(root.ChildList[0].IsDirty, "Child should be dirty after add");
Assert.IsTrue(root.ChildList[0].IsNew, "Child should be new after add");
root = root.Save();
Assert.IsFalse(root.IsDirty, "Root should not be dirty after Save");
Assert.IsFalse(root.IsNew, "Root should not be new");
Assert.IsFalse(root.ChildList.IsDirty, "Child should not be dirty after Save");
Assert.AreEqual("Updated", root.ChildList.Status, "Child list status incorrect after Save");
Assert.IsFalse(root.ChildList[0].IsDirty, "Child should not be dirty after Save");
Assert.IsFalse(root.ChildList[0].IsNew, "Child should not be new after Save");
Assert.AreEqual("Inserted", root.ChildList[0].Status, "Child status incorrect after Save");
Assert.AreEqual("root", root.ChildList[0].RootData, "Parent data is not correct after Save in the list");
Assert.AreEqual("root", root.Child.RootData, "Parent data is not correct after Save in one child");
}
示例5: FetchAndSaveChildList
public void FetchAndSaveChildList()
{
Root root = new Root();
var list = root.ChildList;
Assert.IsFalse(root.ChildList.IsDirty, "Child list should not be dirty");
Assert.AreEqual("Fetched", root.ChildList.Status, "Child list status incorrect after fetch");
list.Add(Child.NewChild());
Assert.IsTrue(root.ChildList.IsDirty, "Child list should be dirty after add");
Assert.IsTrue(root.ChildList[0].IsDirty, "Child should be dirty after add");
Assert.IsTrue(root.ChildList[0].IsNew, "Child should be new after add");
root = root.Save();
Assert.IsFalse(root.IsDirty, "Root should not be dirty after Save");
Assert.IsFalse(root.IsNew, "Root should not be new");
Assert.IsFalse(root.ChildList.IsDirty, "Child should not be dirty after Save");
Assert.AreEqual("Updated", root.ChildList.Status, "Child list status incorrect after Save");
Assert.IsFalse(root.ChildList[0].IsDirty, "Child should not be dirty after Save");
Assert.IsFalse(root.ChildList[0].IsNew, "Child should not be new after Save");
Assert.AreEqual("Inserted", root.ChildList[0].Status, "Child status incorrect after Save");
}