private void MoveNode(string encodedSourcePath, string encodedTargetPath, bool clearTarget = false)
{
string sourcePath = DecodePath(encodedSourcePath);
string targetPath = DecodePath(encodedTargetPath);
int sourceId = Node.LoadNode(sourcePath).Id;
int targetId = Node.LoadNode(targetPath).Id;
//make sure target does not contain the source node
if (clearTarget)
{
var sourceName = RepositoryPath.GetFileNameSafe(sourcePath);
if (!string.IsNullOrEmpty(sourceName))
{
var targetPathWithName = RepositoryPath.Combine(targetPath, sourceName);
if (Node.Exists(targetPathWithName))
Node.ForceDelete(targetPathWithName);
}
}
Node.Move(sourcePath, targetPath);
Node parentNode = Node.LoadNode(targetId);
Node childNode = Node.LoadNode(sourceId);
Assert.IsTrue(childNode.ParentId == parentNode.Id, "Source was not moved.");
}
private void CopyNode(string encodedSourcePath, string encodedTargetPath)