public void GetEndNodeKey_ExistingNodes_ReturnsKey()
        {
            var nodes = new string[] { "Level0", "Some0", "cat0", "dog0", "underlyingName0" };

            var treeMap = new Dictionary <string, BaseNodeViewModel>();

            treeMap.Add("Level0", new NodeViewModel("Level1"));
            treeMap.Add("Level0\\Some0", new NodeViewModel("Some0"));
            treeMap.Add("Level0\\Some0\\cat0", new NodeViewModel("cat0"));

            var endNodeKey = _treeWalker.GetEndNodeKey(nodes, treeMap, (a) => { });

            Assert.AreEqual("Level0\\Some0\\cat0\\dog0\\underlyingName0", endNodeKey);
        }
Beispiel #2
0
        public void AddOrUpdate(TSource endNode, ObservableCollection<BaseNodeViewModel> tree)
        {
            var path = _treeWalker.GetItemPath(endNode);
            if(!Update(path, endNode))
            {
                var pathNodes = _treeWalker.GetFlatTreeNodes(path);
                var endNodeKey = _treeWalker.GetEndNodeKey(pathNodes, TreeMap,
                    (node) =>
                    {
                        tree.Add(node as NodeViewModel);
                    });


                Add(endNodeKey, tree);
            }          
        }