public void TestPreviewAndFinishPendingConnection() { TestableOutput output = new TestableOutput(); var outputNode = new NodeViewModel(); outputNode.Outputs.Add(output); TestableInput input = new TestableInput(); var inputNode = new NodeViewModel(); inputNode.Inputs.Add(input); NetworkViewModel network = new NetworkViewModel { Nodes = { outputNode, inputNode } }; input.CreatePendingConnection_public(); output.SetConnectionPreview_public(true); Assert.AreEqual(output, network.PendingConnection.Output); output.FinishPendingConnection_public(); Assert.AreEqual(null, network.PendingConnection); Assert.AreEqual(1, network.Connections.Count); Assert.AreEqual(input, network.Connections.Items.First().Input); Assert.AreEqual(output, network.Connections.Items.First().Output); }
public void TestHideEditorIfConnected() { TestableOutput output = new TestableOutput(); TestableInput input = new TestableInput(); NetworkViewModel network = new NetworkViewModel { Nodes = { new NodeViewModel { Outputs ={ output } }, new NodeViewModel { Inputs ={ input } } } }; input.HideEditorIfConnected = true; Assert.IsTrue(input.IsEditorVisible); network.Connections.Add(network.ConnectionFactory(input, output)); Assert.IsFalse(input.IsEditorVisible); }
public void TestPreviewAndFinishPendingConnection() { TestableOutput output = new TestableOutput(); TestableInput input = new TestableInput(); NetworkViewModel network = new NetworkViewModel { Nodes = { new NodeViewModel { Outputs ={ output } }, new NodeViewModel { Inputs ={ input } } } }; output.CreatePendingConnection_public(); input.SetConnectionPreview_public(true); Assert.AreEqual(input, network.PendingConnection.Input); input.FinishPendingConnection_public(); Assert.AreEqual(null, network.PendingConnection); Assert.AreEqual(1, network.Connections.Count); Assert.AreEqual(input, network.Connections[0].Input); Assert.AreEqual(output, network.Connections[0].Output); }
public void TestHideEditorIfConnected() { TestableOutput output = new TestableOutput(); TestableInput input = new TestableInput(); var outputNode = new NodeViewModel(); outputNode.Outputs.Add(output); var inputNode = new NodeViewModel(); inputNode.Inputs.Add(input); NetworkViewModel network = new NetworkViewModel { Nodes = { outputNode, inputNode } }; input.HideEditorIfConnected = true; Assert.IsTrue(input.IsEditorVisible); network.Connections.Add(network.ConnectionFactory(input, output)); Assert.IsFalse(input.IsEditorVisible); }
public void TestCreatePendingConnection() { TestableInput input = new TestableInput(); var node = new NodeViewModel(); node.Inputs.Add(input); NetworkViewModel network = new NetworkViewModel(); network.Nodes.Add(node); Assert.AreEqual(null, network.PendingConnection); input.CreatePendingConnection_public(); Assert.AreEqual(input, network.PendingConnection.Input); Assert.IsTrue(network.PendingConnection.InputIsLocked); }
public void TestCreatePendingConnection() { TestableInput input = new TestableInput(); NetworkViewModel network = new NetworkViewModel { Nodes = { new NodeViewModel { Inputs ={ input } } } }; Assert.AreEqual(null, network.PendingConnection); input.CreatePendingConnection_public(); Assert.AreEqual(input, network.PendingConnection.Input); Assert.IsTrue(network.PendingConnection.InputIsLocked); }