public void CreateTreeInvalidTest(params int[] arr) { //arrange ITree <Int32> tree = new AssociativeTree <int>(arr.First()); //result Assert.ThrowsException <TreeException>(() => { arr.Skip(1).ToList().ForEach(value => tree.AddNode(value)); }); }
public void CreateTreeValidTest(params int[] arr) { //arrange ITree <Int32> tree = new AssociativeTree <int>(arr.First()); //act arr.Skip(1).ToList().ForEach(value => tree.AddNode(value)); //result Assert.IsTrue(tree != null); }
public void TreeGetMaxNodeTest(params int[] arr) { //arrange ITree <Int32> tree = new AssociativeTree <int>(arr.First()); //act arr.Skip(1).ToList().ForEach(value => tree.AddNode(value)); int result = tree.GetMaxNode(); //assert Assert.IsTrue(result == arr.Max()); }
public void TreeDeleteNodesTest(int elementForDelete, params int[] arr) { //arrange AssociativeTree <Int32> tree = new AssociativeTree <int>(arr.First()); //act arr.Skip(1).ToList().ForEach(value => tree.AddNode(value)); tree.DeleteNode(elementForDelete); //assert Assert.IsTrue(!tree.Contains(elementForDelete) && tree.Count == (arr.Length - 1)); }
public void TreeContainsTest(int element, params int[] arr) { //arrange ITree <Int32> tree = new AssociativeTree <int>(arr.First()); //act arr.Skip(1).ToList().ForEach(value => tree.AddNode(value)); bool result = tree.Contains(element); //assert Assert.IsTrue(result == arr.Contains(element)); }