Esempio n. 1
0
        public void AddListToXmlConfig()
        {
            // Setup
            var          node         = m_testWindowConfig;
            const string clerkXPath   = "//item[@value='lists']/parameters/clerks/clerk";
            const string commandXPath = "//commands/command";
            const string contextXPath = "//contextMenus/menu";
            const string toolXPath    = "//item[@value='lists']/parameters/tools/tool";
            //var fakeUIDisplay = new UIListDisplayProperties(new XCore.List(node.SelectSingleNode(toolXPath), null));
            //var cdispNodesBefore = fakeUIDisplay.List.Count;
            var contextNodes        = node.SelectNodes(contextXPath);
            var ccontextNodesBefore = contextNodes == null ? 0 : contextNodes.Count;
            var commandNodes        = node.SelectNodes(commandXPath);
            var ccommandNodesBefore = commandNodes == null ? 0 : commandNodes.Count;
            var clerkNodes          = node.SelectNodes(clerkXPath);
            var cclerkNodesBefore   = clerkNodes == null ? 0 : clerkNodes.Count;
            var toolNodes           = node.SelectNodes(toolXPath);
            var ctoolNodesBefore    = toolNodes == null ? 0 : toolNodes.Count;

            const string listName = "testList1";
            var          ws       = WritingSystemServices.kwsAnals;
            var          testList = Cache.ServiceLocator.GetInstance <ICmPossibilityListFactory>().CreateUnowned(listName, ws);

            // SUT
            m_listener.AddListsToWindowConfig(new List <ICmPossibilityList> {
                testList
            }, node);

            // Verify
            // The above routine no longer handles display nodes
            //Assert.AreEqual(cdispNodesBefore + 1, fakeUIDisplay.List.Count, "Didn't add a display node.");
            var ctoolNodesAfter = node.SelectNodes(toolXPath).Count;

            Assert.AreEqual(ctoolNodesBefore + 1, ctoolNodesAfter, "Didn't add a tool node.");
            var cclerkNodesAfter = node.SelectNodes(clerkXPath).Count;

            Assert.AreEqual(cclerkNodesBefore + 1, cclerkNodesAfter, "Didn't add a clerk node.");
            var ccommandNodesAfter = node.SelectNodes(commandXPath).Count;

            Assert.AreEqual(ccommandNodesBefore + 1, ccommandNodesAfter, "Didn't add a command node.");
            var ccontextNodesAfter = node.SelectNodes(contextXPath).Count;

            Assert.AreEqual(ccontextNodesBefore + 1, ccontextNodesAfter, "Didn't add a context menu node.");
        }