/// /// parent2 (not connected) /// /// to: /// parent1 ---> _nodeToBeAdded -> output /// /| /// /
Assert.AreEqual(1, child3.Inputs.Count); Assert.AreEqual(parent1, child3.Inputs.First.Value); Assert.AreEqual(0, child3.Outputs.Count); dummyNetwork.UTTestingFoo(); } /// <summary> /// on graph like: /// /// C1 (1st child of parent1 a.k.a child1 /// /\ /// || /// || /// parent1 ---> _nodeToBeRemoved -> output /// || /| /// \/ / /// C3 / /// / /// parent2 / /// /// it should looke like this after applying patch: /// /// C1 (1st child of parent1 a.k.a child1 /// /\ /// || /// || /// parent1 ---> output /// || /// \/ /// C3 /// /// parent2 /// /// </summary> [TestMethod] public void AddRemoveNodeRemoveApplyAndRevertWhenNodeToRemoveParent1Has3OutputsTest() { Node parent1 = new Node(NodeType.add, 0); Node parent2 = new Node(NodeType.compare, 0); Node child1 = new Node(NodeType.copy, 0); Node child3 = new Node(NodeType.copy, 0); Node nodeToBeRemoved = new Node(NodeType.inverse, 0); Node output = new Node(NodeType.log, 0); parent1.ConnectWithOutput(child1); parent1.ConnectWithOutput(nodeToBeRemoved); parent1.ConnectWithOutput(child3); parent2.ConnectWithOutput(nodeToBeRemoved); nodeToBeRemoved.ConnectWithOutput(output); dummyNetwork.Operations.Add(parent1); dummyNetwork.Operations.Add(parent2); dummyNetwork.Operations.Add(output); dummyNetwork.Operations.Add(nodeToBeRemoved); AddRemoveNode mutator = new AddRemoveNode( nodeChangeType: AddRemoveNode.NodeChangeType.Remove, node: nodeToBeRemoved, parent1: parent1,
parent1.ConnectWithOutput(nodeToBeRemoved); parent2.ConnectWithOutput(nodeToBeRemoved); nodeToBeRemoved.ConnectWithOutput(output1); nodeToBeRemoved.ConnectWithOutput(output2); dummyNetwork.Operations.Add(parent1); dummyNetwork.Operations.Add(parent2);