public void TestFolderCollectionAddRange() { var manifest = CdmCollectionHelperFunctions.GenerateManifest("C:\\Root\\Path"); var parentFolder = new CdmFolderDefinition(manifest.Ctx, "ParentFolder"); parentFolder.Namespace = "TheNamespace"; parentFolder.FolderPath = "ParentFolderPath/"; CdmFolderCollection childFolders = parentFolder.ChildFolders; var childFolder = new CdmFolderDefinition(manifest.Ctx, "ChildFolder1"); var childFolder2 = new CdmFolderDefinition(manifest.Ctx, "ChildFolder2"); var childList = new List <CdmFolderDefinition> { childFolder, childFolder2 }; Assert.AreEqual(0, childFolders.Count); childFolders.AddRange(childList); Assert.AreEqual(2, childFolders.Count); Assert.AreEqual(childFolder, childFolders[0]); Assert.AreEqual(manifest.Ctx, childFolder.Ctx); Assert.AreEqual("ChildFolder1", childFolder.Name); Assert.AreEqual(parentFolder, childFolder.Owner); Assert.AreEqual("TheNamespace", childFolder.Namespace); Assert.AreEqual(parentFolder.FolderPath + childFolder.Name + "/", childFolder.FolderPath); Assert.AreEqual(childFolder2, childFolders[1]); Assert.AreEqual("ChildFolder2", childFolder2.Name); Assert.AreEqual(parentFolder, childFolder2.Owner); Assert.AreEqual("TheNamespace", childFolder2.Namespace); Assert.AreEqual(parentFolder.FolderPath + childFolder2.Name + "/", childFolder2.FolderPath); }
public void TestFolderCollectionRemove() { var manifest = CdmCollectionHelperFunctions.GenerateManifest("C:\\Root\\Path"); var parentFolder = new CdmFolderDefinition(manifest.Ctx, "ParentFolder"); parentFolder.Namespace = "TheNamespace"; parentFolder.FolderPath = "ParentFolderPath/"; CdmFolderCollection childFolders = parentFolder.ChildFolders; var childFolder = new CdmFolderDefinition(manifest.Ctx, "ChildFolder1"); Assert.AreEqual(0, childFolders.Count); childFolders.Add(childFolder); Assert.AreEqual(1, childFolders.Count); childFolders.Remove(childFolder); Assert.AreEqual(0, childFolders.Count); }
public void TestFolderCollectionAddWithNameParameter() { var manifest = CdmCollectionHelperFunctions.GenerateManifest("C:\\Root\\Path"); var parentFolder = new CdmFolderDefinition(manifest.Ctx, "ParentFolder"); parentFolder.Namespace = "TheNamespace"; parentFolder.FolderPath = "ParentFolderPath/"; CdmFolderCollection childFolders = parentFolder.ChildFolders; Assert.AreEqual(0, childFolders.Count); var childFolder = childFolders.Add("ChildFolder1"); Assert.AreEqual(1, childFolders.Count); Assert.AreEqual(childFolder, childFolders[0]); Assert.AreEqual(manifest.Ctx, childFolder.Ctx); Assert.AreEqual("ChildFolder1", childFolder.Name); Assert.AreEqual(parentFolder, childFolder.Owner); Assert.AreEqual("TheNamespace", childFolder.Namespace); Assert.AreEqual(parentFolder.FolderPath + childFolder.Name + "/", childFolder.FolderPath); }