public void Add_in0_outExecption() { //arrange Tree.BinaryTree tree = new Lesson4.Tree.BinaryTree(); //act //assert Assert.Throws <ArgumentNullException>(() => { NodeInfo[] info = TreeHelper.GetTreeInLine(tree); }); }
public void Add_in3_outException() { //arrange Tree.BinaryTree tree = new Lesson4.Tree.BinaryTree(); tree.AddItem(3); tree.AddItem(2); //act //assert Assert.Throws <ArgumentException>(() => { tree.AddItem(3); }); }
public void AssertTreeNodeValue_Root(int value) { //arrange int expected = value; Tree.BinaryTree tree = new Lesson4.Tree.BinaryTree(); tree.AddItem(value); TreeNode node = tree.GetNodeByValue(value); //act int actual = node.Value; //assert Assert.AreEqual(expected, actual); }
public void Add_in1_out0(int value) { //arrange int expected = 0; Tree.BinaryTree tree = new Lesson4.Tree.BinaryTree(); tree.AddItem(value); NodeInfo[] info = TreeHelper.GetTreeInLine(tree); //act int actual = info[0].Depth; //assert Assert.AreEqual(expected, actual); }
public void Add_in3_out1() { //arrange int expected = 1; Tree.BinaryTree tree = new Lesson4.Tree.BinaryTree(); tree.AddItem(3); tree.AddItem(2); tree.AddItem(4); NodeInfo[] info = TreeHelper.GetTreeInLine(tree); //act int actual = info[1].Depth; //assert Assert.AreEqual(expected, actual); }
static void Main(string[] args) { //BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args); //BechmarkClass bClass = new BechmarkClass(); //Console.ReadLine(); Tree.BinaryTree tree = new Tree.BinaryTree(); tree.AddItem(10); //R tree.AddItem(5); //L tree.AddItem(4); //L-L tree.AddItem(3); //L-L tree.AddItem(2); //L-L tree.AddItem(18); //R tree.AddItem(8); //L-R tree.AddItem(7); //L-P-L tree.AddItem(9); // tree.PrintTree(); Console.ReadLine(); }