예제 #1
0
        public void Configure(NavigationGraph graph)
        {
            var dependency = graph.AllNodes().FirstOrDefault(node => _matcher.Matches(node.Key));

            // code was like this for debugging
            if (dependency == null)
            {
                dependency = graph.MenuFor(_matcher.DefaultKey());
            }

            _strategy.Apply(dependency, _node);
        }
예제 #2
0
        public void add_node_and_parent_does_not_exist()
        {
            var graph = new NavigationGraph();

            var node = MenuNode.Node(FakeKeys.Key1);

            graph.AddChildNode(FakeKeys.Key2, node);

            graph.Compile();

            graph.MenuFor(FakeKeys.Key2).Top
                .ShouldBeTheSameAs(node);
        }
예제 #3
0
        public void Configure(NavigationGraph graph)
        {
            var dependency = graph.AllNodes().FirstOrDefault(node => _matcher.Matches(node.Key));

            // code was like this for debugging
            if (dependency == null)
            {
                dependency = graph.MenuFor(_matcher.DefaultKey());
            }



            _strategy.Apply(dependency, _node);
        }
예제 #4
0
        public void add_node_to_another_node()
        {
            var graph = new NavigationGraph();
            var parentNode = MenuNode.Node(FakeKeys.Key1);
            graph.AddChildNode(FakeKeys.Key2, parentNode);

            var childNode = MenuNode.Node(FakeKeys.Key3);

            graph.AddChildNode(FakeKeys.Key1, childNode);

            graph.Compile();

            parentNode.Children.Top
                .ShouldBeTheSameAs(childNode);
        }
예제 #5
0
        public MenuResolverCache(IChainResolver resolver, NavigationGraph graph)
        {
            _inner = new Lazy <NavigationGraph>(() => {
                graph.Compile();
                graph.AllNodes().OfType <MenuNode>().Each(x =>
                {
                    try
                    {
                        x.Resolve(resolver);
                    }
                    catch (Exception ex)
                    {
                        throw new FubuException(4001, ex, "Failed to resolve a BehaviorChain for navigation element " + x.Key);
                    }
                });

                return(graph);
            });
        }
예제 #6
0
        public MenuResolverCache(IChainResolver resolver, NavigationGraph graph)
        {
            _inner = new Lazy<NavigationGraph>(() => {
                graph.Compile();
                graph.AllNodes().OfType<MenuNode>().Each(x =>
                {
                    try
                    {
                        x.Resolve(resolver);
                    }
                    catch (Exception ex)
                    {
                        throw new FubuException(4001, ex, "Failed to resolve a BehaviorChain for navigation element " + x.Key);
                    }

                });

                return graph;
            });
        }
예제 #7
0
 internal void Configure(NavigationGraph graph)
 {
     graph.AddRegistrations(_registrations);
 }
예제 #8
0
 internal void Configure(NavigationGraph graph)
 {
     graph.AddRegistrations(_registrations);
 }
        public void Configure(ActionCall action, MenuItemAttribute att, NavigationGraph graph)
        {
            var registrations = att.ToMenuRegistrations(action.ParentChain());

            graph.AddRegistrations(registrations);
        }
예제 #10
0
        public void SetUp()
        {
            graph = new NavigationGraph(x =>
            {
                x.ForMenu(FakeKeys.Key1);
                x.Add += MenuNode.Node(FakeKeys.Key2);
                x.Add += MenuNode.Node(FakeKeys.Key3);
                x.Add += MenuNode.Node(FakeKeys.Key4);

                x.ForMenu(FakeKeys.Key5);
                x.Add += MenuNode.Node(FakeKeys.Key6);
                x.Add += MenuNode.Node(FakeKeys.Key7);

                x.ForMenu(FakeKeys.Key2);
                x.Add += MenuNode.Node(FakeKeys.Key8);
                x.Add += MenuNode.Node(FakeKeys.Key9);

                x.ForMenu(FakeKeys.Key9);
                x.Add += MenuNode.Node(FakeKeys.Key10);
            });

            graph.Compile();
        }