public static void CreateTestTree(this SerializationFileSystemTree tree, string globalPath, string database = "master") { var localPath = tree.ConvertGlobalVirtualPathToTreeVirtualPath(globalPath) .TrimStart('/') .Split('/'); var contextPath = string.Empty; Guid currentParentId = default(Guid); FakeItem currentParent = null; foreach (var pathPiece in localPath) { // the first path piece will equal the last segment in the global root - don't double append if (pathPiece != localPath[0]) { contextPath += "/" + pathPiece; } var item = AsTestItem(tree.GlobalRootItemPath + contextPath, currentParentId, databaseName: database); currentParentId = item.Id; currentParent?.SetProxyChildren(new[] { item }); currentParent = item; tree.Save(item); } }