Example #1
0
        public void Try_GetItemsForTypeId()
        {
            ProcessWorkspaceItemsDelegate processWorkspaceItemsDelegate = ProcessWorkspaceItems;
            IEnumerable <WorkspaceItem>   items = _agent.GetItemsForTypeId(_languageTypeId);

            Assert.AreNotEqual(CAmountLanguages, items.Count());
            processWorkspaceItemsDelegate(items.ToArray(), PrintWorkspaceItem);
            DebugWriteFinished("Try_GetItemsOfTypeId finished on {0}");
        }
Example #2
0
        public void Try_GetWorkspaceItemsBySearchString()
        {
            WorkspaceItem[] items = _agent.GetWorkspaceItemsBySearchString(CSearchString).ToArray();
            ProcessWorkspaceItemsDelegate processWorkspaceItemsDelegate = ProcessWorkspaceItems;
            ProcessWorkspaceItemDelegate  processWorkspaceItemDelegate  = PrintWorkspaceItem;

            processWorkspaceItemsDelegate(items, processWorkspaceItemDelegate);
            Assert.AreEqual(CAmountSpecificSearchStrings, items.Count());
            DebugWriteFinished("Try_GetWorkspaceItemsBySearchString finished on {0}");
        }
Example #3
0
        public WorkspaceItem[] Try_GetWorkspace(string parentId, bool ignoreAssert)
        {
            WorkspaceItem[] items = _agent.GetWorkspace(parentId).ToArray();
            ProcessWorkspaceItemsDelegate processWorkspaceItemsDelegate = ProcessWorkspaceItems;
            ProcessWorkspaceItemDelegate  processWorkspaceItemDelegate  = PrintWorkspaceItem;

            processWorkspaceItemsDelegate(items, processWorkspaceItemDelegate);
            if (!ignoreAssert)
            {
                Assert.AreNotEqual(0, items.Count());
            }
            return(items);
        }
Example #4
0
        public void Try_RegisterWorkspace()
        {
            ProcessWorkspaceItemsDelegate processWorkspaceItemsDelegate = ProcessWorkspaceItems;

            _items = new WorkspaceItem[CAmountItemsToRegister];

            #region " Structure created by Try_RegisterWorkspace "
            // Structure              | Title                              | Id                                   | Parent
            // =========================================================================================================================================
            // ROOT                   | Root                               | ROOT                                 | ROOT
            //  |---1                 | Applications                       | 00000001-0000-0000-0000-000000000000 | ROOT
            //  |   |                 |                                    |                                      |
            //  |   |---2             | Business applications              | 00000002-0000-0000-0000-000000000000 | 00000001-0000-0000-0000-000000000000
            //  |   |   |---3         | Business application 1             | 00000003-0000-0000-0000-000000000000 | 00000002-0000-0000-0000-000000000000
            //  |   |   |---4         | Business application 2             | 00000004-0000-0000-0000-000000000000 | 00000002-0000-0000-0000-000000000000
            //  |   |   |---5         | Business application 3             | 00000005-0000-0000-0000-000000000000 | 00000002-0000-0000-0000-000000000000
            //  |   |                 |                                    |
            //  |   |---6             | My applications                    | 00000006-0000-0000-0000-000000000000 | 00000001-0000-0000-0000-000000000000
            //  |   |   |---7         | My applications type 1             | 00000007-0000-0000-0000-000000000000 | 00000006-0000-0000-0000-000000000000
            //  |   |   |   |---9     | My applications 1.1                | 00000008-0000-0000-0000-000000000000 | 00000006-0000-0000-0000-000000000000
            //  |   |   |       |---A | My applications 1 of type 1        | 00000009-0000-0000-0000-000000000000 | 00000007-0000-0000-0000-000000000000
            //  |   |   |       |---B | My applications 2 of type 1        | 0000000a-0000-0000-0000-000000000000 | 00000009-0000-0000-0000-000000000000
            //  |   |   |             |                                    |
            //  |   |   |---8         | My applications type 2             | 0000000b-0000-0000-0000-000000000000 | 00000009-0000-0000-0000-000000000000
            //  |   |       |---C     | My application 3                   | 0000000c-0000-0000-0000-000000000000 | 00000008-0000-0000-0000-000000000000
            //  |   |       |---D     | My application 4                   | 0000000d-0000-0000-0000-000000000000 | 00000008-0000-0000-0000-000000000000
            //  |   |       |---E     | My + CSearchString + application 1 | 0000000e-0000-0000-0000-000000000000 | 00000008-0000-0000-0000-000000000000
            //  |   |       |---F     | My + CSearchString + application 2 | 0000000f-0000-0000-0000-000000000000 | 00000008-0000-0000-0000-000000000000
            //  |   |                 |                                    |
            //  |   |---10            | App item 1                         | 00000010-0000-0000-0000-000000000000 | 00000001-0000-0000-0000-000000000000
            //  |   |---11            | App item 2                         | 00000011-0000-0000-0000-000000000000 | 00000001-0000-0000-0000-000000000000
            //  |   |---12            | App item 3                         | 00000012-0000-0000-0000-000000000000 | 00000001-0000-0000-0000-000000000000
            #endregion

            CreateWorkspaceItemToRegister(_guids[_index].ToString(), CWorkspaceRootId, true, "Applications");
            CreateWorkspaceItemToRegister(_guids[_index].ToString(), _items[0].Id, true, "Business applications");
            CreateWorkspaceItemToRegister(_guids[_index].ToString(), _items[1].Id, false, "Business application 1");
            CreateWorkspaceItemToRegister(_guids[_index].ToString(), _items[1].Id, false, "Business application 2");
            CreateWorkspaceItemToRegister(_guids[_index].ToString(), _items[1].Id, false, "Business application 3");
            CreateWorkspaceItemToRegister(_guids[_index].ToString(), _items[0].Id, true, "My applications");
            CreateWorkspaceItemToRegister(_guids[_index].ToString(), _items[5].Id, true, "My applications type 1");
            CreateWorkspaceItemToRegister(_guids[_index].ToString(), _items[5].Id, true, "My applications type 2");
            CreateWorkspaceItemToRegister(_guids[_index].ToString(), _items[6].Id, true, "My applications type 1.1");
            CreateWorkspaceItemToRegister(_guids[_index].ToString(), _items[8].Id, false, "My applications 1 of type 1");
            CreateWorkspaceItemToRegister(_guids[_index].ToString(), _items[8].Id, false, "My applications 2 of type 1");
            CreateWorkspaceItemToRegister(_guids[_index].ToString(), _items[7].Id, false, "My application 3");
            CreateWorkspaceItemToRegister(_guids[_index].ToString(), _items[7].Id, false, "My application 4");
            CreateWorkspaceItemToRegister(_guids[_index].ToString(), _items[7].Id, false, String.Format("My {0} application 1", CSearchString));
            CreateWorkspaceItemToRegister(_guids[_index].ToString(), _items[7].Id, false, String.Format("My {0} application 2", CSearchString));
            CreateWorkspaceItemToRegister(_guids[_index].ToString(), _items[0].Id, false, "App item 1");
            CreateWorkspaceItemToRegister(_guids[_index].ToString(), _items[0].Id, false, "App item 2");
            CreateWorkspaceItemToRegister(_guids[_index].ToString(), _items[0].Id, false, "App item 3");

            var s = String.Format("Try_RegisterWorkspace [{0}] = {1}", _index, processWorkspaceItemsDelegate(_items, RegisterWorkspaceItem));
            Debug.WriteLine(s); Logger.Info(s);

            WorkspaceItem[] itemsRoot   = Try_GetWorkspace(new Guid(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0).ToString());
            var             resultTotal = itemsRoot.Count();
            // amount of folders under ROOT
            var resultFolders = (from item in itemsRoot
                                 where item.TypeId == _treeViewFolderTypeId
                                 select item).Count();
            // amount of nodes under ROOT
            var resultNodes = (from item in itemsRoot
                               where item.TypeId == _treeViewLeafTypeId
                               select item).Count();
            Assert.AreEqual(CAmountRootTotal, resultTotal);
            Assert.AreEqual(CAmountFoldersUnderRoot, resultFolders);
            Assert.AreEqual(CAmountNodesUnderRoot, resultNodes);

            DebugWriteFinished("Try_RegisterWorkspace finished on {0}");
        }