public void Node_DeletePhysical_WithChildren() { InstallTestNodeType(); string path = RepositoryPath.Combine(this.TestRoot.Path, "Delete_TestNode_Parent"); TestNode parentNode = (TestNode)Node.LoadNode(path); if (parentNode == null) { parentNode = new TestNode(this.TestRoot); parentNode.Name = "Delete_TestNode_Parent"; parentNode.Save(); } Assert.IsNotNull(parentNode, "Parent TestNode has not been created."); string childpath = RepositoryPath.Combine(parentNode.Path, "Delete_TestNode_Child"); TestNode childNode = (TestNode)Node.LoadNode(childpath); if (childNode == null) { childNode = new TestNode(parentNode); childNode.Name = "Delete_TestNode_Child"; childNode.Save(); } Assert.IsNotNull(childNode, "Child TestNode has not been created."); Assert.IsTrue(TestTools.DataProvider_Current_HasChild(parentNode.Id), "ParentNode has not children."); parentNode.ForceDelete(); Node target = Node.LoadNode(parentNode.Path); Assert.IsNull(target, "Node has NOT been deleted from database."); }
//[TestMethod()] //[ExpectedException(typeof(NodeIsOutOfDateException))] //public void Node_Save_Refresh_Dirty() //{ // var file = new File(this.TestRoot) { Index = 1 }; // file.Save(); // //modify private field to avoid refresh // typeof (Node).InvokeMember("IsDirty", // BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.SetProperty | // BindingFlags.Instance, null, file, new object[] {false}); // file.Index = 10; // file.Save(); //} #endregion #region Delete tests private Node CreateTestNodeForDelete() { InstallTestNodeType(); string path = RepositoryPath.Combine(this.TestRoot.Path, "Delete_TestNode"); TestNode node = (TestNode)Node.LoadNode(path); if (node == null) { node = new TestNode(this.TestRoot); node.Name = "Delete_TestNode"; node.TestInt = 1234; node.Save(); } return (Node)node; }