public void resizeChildredArrayWhenEmpty() { Problem3 p3 = new Problem3(); p3.addNode(5, p3._head); int expectedCount = 2; bool expected = true; bool actual = p3.changeNodeValue(2, p3._head); int actualCount = p3._head.children.Length; Assert.AreEqual(expected, actual, "Resize of children array failed"); Assert.AreEqual(expectedCount, actualCount, "Children array not resized"); }
public void resizePopulatedChildredArrayToNumberOfChildren() { Problem3 p3 = new Problem3(); p3.addNode(5, p3._head); Node expectedChild1 = p3.addNode(1, p3._head); Node expectedChild2 = p3.addNode(1, p3._head); int expectedCount = 2; bool expected = true; bool actual = p3.changeNodeValue(2, p3._head); int actualCount = p3._head.children.Length; Node actualChild1 = p3._head.children[0]; Node actualChild2 = p3._head.children[1]; Assert.AreEqual(expected, actual, "Resize of children array failed"); Assert.AreEqual(expectedCount, actualCount, "Children array not resized"); Assert.AreEqual(expectedChild1, actualChild1, "Children not saved when array resized"); Assert.AreEqual(expectedChild2, actualChild2, "Children not saved when array resized"); }