public void ShouldAddParentNodeToNode() { ExecutionNode root = ExecutionNode.CreateLevelOneNode(1, "Root"); var customer = root.AddChild(1, "Customer"); var order = customer.AddChild(10, "Order"); string expected = @"-Customer --Order"; Assert.That(customer.getDebugString(), Is.EqualTo(expected)); order.AddParent(1, "CustomerGroup"); expected = @"Root -Customer --CustomerGroup ---Order"; Assert.That(root.getDebugString(), Is.EqualTo(expected)); customer.AddParent(1, "Country"); expected = @"Root -Country --Customer ---CustomerGroup ----Order"; Assert.That(root.getDebugString(), Is.EqualTo(expected)); }
public void ShouldNotBeAbleToAddParentToRoot() { ExecutionNode root = ExecutionNode.CreateLevelOneNode(1, "Root"); var customer = root.AddChild(1, "Customer"); var order = customer.AddChild(10, "Order"); string beforeAddingParent = root.getDebugString(); var returnNode = root.AddParent(1, "Nono"); Assert.That(returnNode, Is.EqualTo(root)); Assert.That(root.getDebugString(), Is.EqualTo(beforeAddingParent)); }
public void ShouldCreateDebugString() { ExecutionNode root = ExecutionNode.CreateLevelOneNode(1, "Root"); var customer = root.AddChild(1, "Customer"); var order = customer.AddChild(10, "Order"); root.AddChild(1, "Invoice"); string expected = @"Root -Customer --Order -Invoice"; string actual = root.getDebugString(); Console.WriteLine("{" + actual + "}"); Console.WriteLine("{" + expected + "}"); Assert.That(actual, Is.EqualTo(expected)); Assert.That(order.getDebugString(), Is.EqualTo("--Order")); Assert.That(customer.getDebugString(), Is.EqualTo("-Customer" + Environment.NewLine + "--Order")); }