public void TestRectangleSelection() { 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 } }; network.StartRectangleSelection(); network.SelectionRectangle.IntersectingNodes.Add(nodeA); network.SelectionRectangle.IntersectingNodes.Add(nodeD); network.FinishRectangleSelection(); Assert.IsTrue(network.SelectedNodes.SequenceEqual(new[] { nodeA, nodeD })); }