public void OnlyOneChildPerValue() { string value = OrNodeTest.Domain.PossibleValues[0]; var child1 = OrNodeTest.CreateNode("child1"); var child2 = OrNodeTest.CreateNode("child2"); this._decisionNode.AddChild(value, child1); Assert.Throws <ArgumentException>(() => this._decisionNode.AddChild(value, child2)); }
public void ChildrenAreReturnedCorrectly() { // Add several children... var children = new List <IParameterTreeNode>(); var domainValues = OrNodeTest.Domain.PossibleValues; for (int i = 0; i < domainValues.Count; i++) { IParameterTreeNode child = OrNodeTest.CreateNode(domainValues[i] + "_child"); children.Add(child); this._decisionNode.AddChild(domainValues[i], child); } // ..and compare them with the returned set when querying for the node's children. Assert.True( TestUtils.SetsAreEquivalent(children, this._decisionNode.Children), $"Added children {TestUtils.PrintList(children)}, but return value was {TestUtils.PrintList(this._decisionNode.Children)}"); }
public void ValueSpecifiedForChildBranchMustExist() { string value = "notExisting"; Assert.DoesNotContain(value, OrNodeTest.Domain.PossibleValues); Assert.Throws <ArgumentException>(() => this._decisionNode.AddChild(value, OrNodeTest.CreateNode("child"))); }