Ejemplo n.º 1
0
        public void TestCutLine()
        {
            NodeOutputViewModel nodeAOutput = new NodeOutputViewModel();
            NodeViewModel       nodeA       = new NodeViewModel();

            nodeA.Outputs.Add(nodeAOutput);

            NodeInputViewModel  nodeBInput  = new NodeInputViewModel();
            NodeOutputViewModel nodeBOutput = new NodeOutputViewModel();
            NodeViewModel       nodeB       = new NodeViewModel
            {
                CanBeRemovedByUser = false,
                IsSelected         = true
            };

            nodeB.Inputs.Add(nodeBInput);
            nodeB.Outputs.Add(nodeBOutput);

            NodeInputViewModel nodeCInput = new NodeInputViewModel();
            NodeViewModel      nodeC      = new NodeViewModel
            {
                IsSelected = true
            };

            nodeC.Inputs.Add(nodeCInput);

            NodeViewModel nodeD = new NodeViewModel
            {
                IsSelected = true
            };

            NetworkViewModel network = new NetworkViewModel
            {
                Nodes = { nodeA, nodeB, nodeC, nodeD }
            };

            var conAB = network.ConnectionFactory(nodeBInput, nodeAOutput);
            var conBC = network.ConnectionFactory(nodeCInput, nodeBOutput);

            network.Connections.Add(conAB);
            network.Connections.Add(conBC);

            network.StartCut();
            network.CutLine.IntersectingConnections.Add(conAB);
            network.FinishCut();

            Assert.IsTrue(network.Connections.Items.SequenceEqual(new [] { conBC }));
            Assert.IsFalse(network.CutLine.IsVisible);
        }