/// /// parent2 (not connected) /// /// to: /// parent1 ---> _nodeToBeAdded -> output /// /| /// /
outputs: new List<Node>(nodeToBeRemoved.Outputs), network: dummyNetwork); mutator.Apply(); mutator.Revert(); Assert.AreEqual(0, parent1.Inputs.Count); Assert.AreEqual(3, parent1.Outputs.Count); Assert.AreEqual(child1, parent1.Outputs.First.Value); Assert.AreEqual(nodeToBeRemoved, parent1.Outputs.First.Next.Value); Assert.AreEqual(child3, parent1.Outputs.Last.Value); Assert.AreEqual(0, parent2.Inputs.Count); Assert.AreEqual(1, parent2.Outputs.Count); Assert.IsNotNull(parent2.Outputs.Find(nodeToBeRemoved)); Assert.AreEqual(2, nodeToBeRemoved.Inputs.Count); Assert.AreEqual(parent1, nodeToBeRemoved.Inputs.First.Value); Assert.AreEqual(parent2, nodeToBeRemoved.Inputs.Last.Value); Assert.AreEqual(2, nodeToBeRemoved.Outputs.Count); Assert.AreEqual(output1, nodeToBeRemoved.Outputs.First.Value); Assert.AreEqual(output2, nodeToBeRemoved.Outputs.Last.Value); Assert.AreEqual(1, output1.Inputs.Count); Assert.IsNotNull(output1.Inputs.Find(nodeToBeRemoved)); Assert.AreEqual(0, output1.Outputs.Count); Assert.AreEqual(1, output2.Inputs.Count); Assert.IsNotNull(output2.Inputs.Find(nodeToBeRemoved)); Assert.AreEqual(0, output2.Outputs.Count); Assert.AreEqual(1, child1.Inputs.Count); Assert.AreEqual(parent1, child1.Inputs.First.Value); Assert.AreEqual(0, child1.Outputs.Count); 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 / /// /// there should be no changes after applying remove and revering it /// </summary> [TestMethod] public void AddRemoveNodeRemoveApplyAndRevertWhenNodeToRemoveParent1Has3OutputsApplyAndRevertTest() { 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);