public void find_immediate_treenode_parent_as_top() { var parent = new TreeNode(new Test("name")); parent.Items.Add(node); node.Top().ShouldBeTheSameAs(parent); }
public void can_get_contextual_commands_for_a_TreeNode() { var node = new TreeNode(new Test("test1")); IEnumerable<IContextualAction> actions = _objectLocator.BuildActions(node); actions.Count(x => x is CollapseAllCommand).ShouldEqual(1); actions.Count(x => x is ExpandAllCommand).ShouldEqual(1); }
public static void Show(TreeNode hierarchyNode) { List<TreeNodeToken> list = getActual(hierarchyNode); foreach (TreeNodeToken token in list) { Debug.WriteLine(token); } }
private static void addChildren(TreeNode node, List<TreeNodeToken> actual) { foreach (TreeNode child in node.Items) { addToken(child, actual); addChildren(child, actual); } }
public void add_a_test_node_directly_to_the_hierarchy() { var top = new TreeNode(new Hierarchy("project1")); var builder = new TreeBuilder(top); var test = new Test("test1"); builder.Test(test); top.Children.ShouldEqual(new INamedItem[] {test}); }
public void add_a_suite_node_directly_to_the_hierarchy() { var top = new TreeNode(new Hierarchy("project1")); var builder = new TreeBuilder(top); var suite = new Suite("suite1"); builder.StartSuite(suite); top.Children.ShouldEqual(new INamedItem[] {suite}); }
public void find_ultimate_anscestor_as_top() { var parent = new TreeNode(new Test("name")); parent.Items.Add(node); var top = new TreeNode(new Hierarchy("project")); top.Items.Add(parent); node.Top().ShouldBeTheSameAs(top); }
public void add_suite_then_add_test() { var top = new TreeNode(new Hierarchy("project1")); var builder = new TreeBuilder(top); var suite = new Suite("suite1"); var test = new Test("test1"); builder.StartSuite(suite); builder.Test(test); top.Items[0].ShouldBeOfType<TreeNode>().Children.ShouldEqual(new INamedItem[] {test}); }
private static void addToken(TreeNode node, List<TreeNodeToken> actual) { string locator = node.Subject.GetPath().Locator; string typeName = node.Subject.GetType().Name.ToLower(); var token = new TreeNodeToken { Path = locator, Type = typeName }; actual.Add(token); }
public void ctrl_left_clicking_the_node_fires_the_on_run_node_gesture() { TreeNode nodeThatWasCalled = null; var parent = new TreeNode(new Test("name")); parent.Items.Add(node); var top = new TreeNode(new Hierarchy("project")); top.Items.Add(parent); top.OnRunNodeGesture = n => nodeThatWasCalled = n.Top(); ControlDriver.ExecuteMouseGestureCommand(node, new MouseGesture(MouseAction.LeftClick, ModifierKeys.Control)); nodeThatWasCalled.ShouldBeTheSameAs(top); }
public IList<ActionMenuItem> BuildMenuItems(TreeNode node) { var list = new List<ActionMenuItem>(); IEnumerable<ActionMenuItem> nodeItems = _screenObjects.BuildActions(node).Select(x => new ActionMenuItem(x)); IEnumerable<ActionMenuItem> subjectItems = _screenObjects.BuildActions(node.Subject).Select(x => new ActionMenuItem(x)); list.AddRange(nodeItems); list.AddRange(subjectItems); return list; }
public void add_suite_then_add_test_then_finish_suite_then_add_test_directly_to_hierarchy() { var top = new TreeNode(new Hierarchy("project1")); var builder = new TreeBuilder(top); var suite = new Suite("suite1"); var test1 = new Test("test1"); var test2 = new Test("test2"); builder.StartSuite(suite); builder.Test(test1); builder.EndSuite(suite); builder.Test(test2); top.Children.ShouldEqual(new INamedItem[] {suite, test2}); }
public void double_clicking_fires_the_OnSelection_action_on_the_top() { TreeNode nodeThatWasCalled = null; var parent = new TreeNode(new Test("name")); parent.Items.Add(node); var top = new TreeNode(new Hierarchy("project")); top.Items.Add(parent); top.OnSelection = n => nodeThatWasCalled = n.Top(); ControlDriver.FireEvent(node, "MouseDoubleClick"); nodeThatWasCalled.ShouldBeTheSameAs(top); }
public void AssertMatch(TreeNode hierarchyNode) { List<TreeNodeToken> actual = getActual(hierarchyNode); try { Assert.AreEqual(_tokens.Count, actual.Count, "the count"); actual.ShouldHaveTheSameElementsAs((IList) _tokens); } catch (Exception) { actual.ForEach(x => Debug.WriteLine(x)); throw; } }
public void RunNode(TreeNode node) { IContextualAction action = null; //Something smells. I can't quite make out what it is. Oh wait, it's this LSP violation. if (node.Subject is Suite) { action = _screenObjects.CommandForSubject<RunSuiteCommand, Suite>(node.Subject); } else { action = _screenObjects.CommandForSubject<RunTestCommand, Test>(node.Subject); } if(action != null) { action.Execute(); } }
public bool Equals(TreeNode obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; return base.Equals(obj) && Equals(obj._subject, _subject); }
private void activateNode(TreeNode node, TreeView tree) { if (tree.Items.Count > 0) { tree.Items[0].As<TreeNode>().OnSelection = n => { }; } tree.Items.Clear(); node.IsExpanded = true; node.OnSelection = n => SelectNode(n); node.OnRunNodeGesture = n => RunNode(n); node.BuildItems = n => BuildMenuItems(n); tree.Items.Add(node); }
public void update_icon_two_levels_up() { var veryTop = new TreeNode(new FixtureLibrary()); veryTop.Add(top); veryTop.Add(new TreeNode(new FixtureLibrary())); veryTop.NodeAt(1).Icon = Icon.Success; top.NodeAt(3).Icon = Icon.Failed; veryTop.Icon.ShouldEqual(Icon.Failed); }
public void Remove(TreeNode node) { Items.Remove(node); }
public void SetUp() { test = new Test("some test"); node = new TreeNode(test); }
public void SetUp() { top = new TreeNode(new FixtureLibrary()); top.Add(new TreeNode(new FixtureLibrary())); top.Add(new TreeNode(new FixtureLibrary())); top.Add(new TreeNode(new FixtureLibrary())); top.Add(new TreeNode(new FixtureLibrary())); top.Add(new TreeNode(new FixtureLibrary())); }
private static List<TreeNodeToken> getActual(TreeNode hierarchyNode) { var actual = new List<TreeNodeToken>(); addChildren(hierarchyNode, actual); return actual; }
public void UpdateIcon() { if (Items.Count == 0) return; var nodes = new TreeNode[Items.Count]; Items.CopyTo(nodes, 0); Icon = nodes.Select(x => x.As<TreeNode>().Icon).OrderBy(x => x).First(); updateParentIcon(); }
public TreeBuilder(TreeNode topNode) : this(topNode, new TestNodeCache(), new SuiteNodeCache()) { }
public TreeBuilder(TreeNode topNode, TestNodeCache testCache, SuiteNodeCache suiteCache) { _testCache = testCache; _suiteCache = suiteCache; _parent.Push(topNode); }
private void activateNode(TreeNode node, TreeView tree) { tree.Items.Clear(); node.IsExpanded = true; node.BuildItems = n => BuildMenuItems(n); tree.Items.Add(node); }
public void ApplyFixtureNode(TreeNode node) { activateNode(node, _fixtureTree); }
public void ApplyProjectNode(TreeNode node) { activateNode(node, _testTree); }
public void SelectNode(TreeNode node) { if (_latched) { if (ReferenceEquals(node, node.Top())) { _latched = false; } return; } // TODO -- harden this _conductor.OpenScreen(node.Subject); _latched = true; }
public void Add(TreeNode node) { node.ClearParent(); Items.Add(node); }