Ejemplo n.º 1
0
        public void FolderIn2FolderShouldGet2PathWith2Folder()
        {
            using (WebActionExecutor executor = new WebActionExecutor())
            {
                var cc             = this.getGlobalObject <IGlobalContentCreator>();
                var folder         = cc.getAndAddNewContent <DMSFolder>();
                var parent_folder1 = cc.getAndAddNewContent <DMSFolder>();
                var parent_folder2 = cc.getAndAddNewContent <DMSFolder>();
                folder.parent_folders.Add(parent_folder1);
                folder.parent_folders.Add(parent_folder2);
                var input  = new ContentReference(folder);
                var action = new GetDmsPathsAction();
                action.input = input;
                action.Authorize();
                var paths = action.Execute().output.paths;
                Assert.AreEqual(2, paths.Count());
                Assert.AreEqual(2, paths.FirstOrDefault().Count());
                Assert.AreEqual(2, paths.Skip(1).FirstOrDefault().Count());



                //we don't know the order
                var parent_guids = new HashSet <Guid>()
                {
                    parent_folder1.guid, parent_folder2.guid
                };
                foreach (var path in paths)
                {
                    Assert.IsTrue(parent_guids.Contains(path.FirstOrDefault().guid));
                }
            }
        }
Ejemplo n.º 2
0
        public void ParentFolderContainedInChildShouldNoGoRecursive()
        {
            using (WebActionExecutor executor = new WebActionExecutor())
            {
                var cc      = this.getGlobalObject <IGlobalContentCreator>();
                var folder1 = cc.getAndAddNewContent <DMSFolder>();
                var folder2 = cc.getAndAddNewContent <DMSFolder>();
                folder1.parent_folders.Add(folder2);
                folder2.parent_folders.Add(folder1);
                var input  = new ContentReference(folder1);
                var action = new GetDmsPathsAction();
                action.input = input;
                action.Authorize();
                var paths = action.Execute().output.paths;

                Assert.AreEqual(1, paths.Count());
                Assert.AreEqual(2, paths.FirstOrDefault().Count());

                input        = new ContentReference(folder2);
                action       = new GetDmsPathsAction();
                action.input = input;
                action.Authorize();
                paths = action.Execute().output.paths;

                Assert.AreEqual(1, paths.Count());
                Assert.AreEqual(2, paths.FirstOrDefault().Count());
            }
        }
Ejemplo n.º 3
0
 public void FloatingVersionShouldHaveNoPaths()
 {
     using (WebActionExecutor executor = new WebActionExecutor())
     {
         var cc      = this.getGlobalObject <IGlobalContentCreator>();
         var version = cc.getAndAddNewContent <DMSVersion>();
         var input   = new ContentReference(version);
         var action  = new GetDmsPathsAction();
         action.input = input;
         action.Authorize();
         var paths = action.Execute().output.paths;
         Assert.AreEqual(0, paths.Count());
     }
 }
Ejemplo n.º 4
0
 public void FloatingFolderShouldHaveOnly1PathWithThemInIt()
 {
     using (WebActionExecutor executor = new WebActionExecutor())
     {
         var cc     = this.getGlobalObject <IGlobalContentCreator>();
         var folder = cc.getAndAddNewContent <DMSFolder>();
         var input  = new ContentReference(folder);
         var action = new GetDmsPathsAction();
         action.input = input;
         action.Authorize();
         var paths = action.Execute().output.paths;
         Assert.AreEqual(1, paths.Count());
         Assert.AreEqual(1, paths.FirstOrDefault().Count());
         Assert.AreEqual(folder.guid, paths.FirstOrDefault().FirstOrDefault().guid);
     }
 }