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);
        }
示例#5
0
        public void TestCreatePendingConnection()
        {
            TestableOutput output = new TestableOutput();
            var            node   = new NodeViewModel();

            node.Outputs.Add(output);

            NetworkViewModel network = new NetworkViewModel();

            network.Nodes.Add(node);

            Assert.AreEqual(null, network.PendingConnection);

            output.CreatePendingConnection_public();

            Assert.AreEqual(output, network.PendingConnection.Output);
            Assert.IsTrue(network.PendingConnection.OutputIsLocked);
        }
        public void TestCreatePendingConnection()
        {
            TestableOutput   output  = new TestableOutput();
            NetworkViewModel network = new NetworkViewModel
            {
                Nodes =
                {
                    new NodeViewModel
                    {
                        Outputs ={ output               }
                    }
                }
            };

            Assert.AreEqual(null, network.PendingConnection);

            output.CreatePendingConnection_public();

            Assert.AreEqual(output, network.PendingConnection.Output);
            Assert.IsTrue(network.PendingConnection.OutputIsLocked);
        }