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); }
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); }
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); }
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); }); }
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; }); }
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); }
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(); }