public void Clear() { var t = new MapTree(); var r = new MapNode(t, "r"); var c1 = new MapNode(r, "c1"); var c11 = new MapNode(c1, "c11"); var c12 = new MapNode(c1, "c12"); var c121 = new MapNode(c12, "c121"); var c13 = new MapNode(c1, "c13"); var c131 = new MapNode(c13, "c131"); var c1311 = new MapNode(c131, "c1311"); var c2 = new MapNode(r, "c2"); var c3 = new MapNode(r, "c3", NodePosition.Left); var c31 = new MapNode(c3, "c31"); var c32 = new MapNode(c3, "c32"); t.SelectAllNodes(); int count = 0; t.SelectedNodes.NodeDeselected += (node, nodes) => count++; t.SelectedNodes.Clear(); Assert.AreEqual(12, count); }
public void GetEnumerator() { var t = new MapTree(); var r = new MapNode(t, "r"); var c1 = new MapNode(r, "c1"); var c11 = new MapNode(c1, "c11"); var c12 = new MapNode(c1, "c12"); var c121 = new MapNode(c12, "c121"); var c13 = new MapNode(c1, "c13"); var c131 = new MapNode(c13, "c131"); var c1311 = new MapNode(c131, "c1311"); var c2 = new MapNode(r, "c2"); var c3 = new MapNode(r, "c3", NodePosition.Left); var c31 = new MapNode(c3, "c31"); var c32 = new MapNode(c3, "c32"); t.SelectAllNodes(); int count = 0; foreach (var node in t.SelectedNodes) { count++; } Assert.AreEqual(12, count); }
public void ExcludeNodesAlreadyPartOfHierarchy() { var t = new MapTree(); var r = new MapNode(t, "r"); var c1 = new MapNode(r, "c1"); var c11 = new MapNode(c1, "c11"); var c12 = new MapNode(c1, "c12"); var c121 = new MapNode(c12, "c121"); var c13 = new MapNode(c1, "c13"); var c131 = new MapNode(c13, "c131"); var c1311 = new MapNode(c131, "c1311"); var c2 = new MapNode(r, "c2"); var c3 = new MapNode(r, "c3", NodePosition.Left); var c31 = new MapNode(c3, "c31"); var c32 = new MapNode(c3, "c32"); t.SelectAllNodes(); var exclude = t.SelectedNodes.ExcludeNodesAlreadyPartOfHierarchy(); for (int i = 0; i < t.SelectedNodes.Count; i++) { if (t.SelectedNodes[i] != r && !exclude[i]) { Assert.Fail(); } } Assert.AreEqual(1, exclude.Count(b => !b)); }