Esempio n. 1
0
        /// <summary> Connect this <see cref="NodePort"/> to another </summary>
        /// <param name="port">The <see cref="NodePort"/> to connect to</param>
        public void Connect(INodePort port)
        {
            if (connections == null)
            {
                connections = new List <PortConnection>();
            }

            if (!ConnectionValidator.Validate(this, port))
            {
                return;
            }

            if (port.ConnectionType == ConnectionType.Override && port.ConnectionCount != 0)
            {
                port.ClearConnections();
            }

            if (ConnectionType == ConnectionType.Override && ConnectionCount != 0)
            {
                ClearConnections();
            }

            var portNode = port.Node;

            connections.Add(new PortConnection(port, portNode.Id));

            if (!port.IsConnectedTo(this))
            {
                port.CreateConnection(nodeId, ItemName);
            }
        }
Esempio n. 2
0
        /// <summary> Connect this <see cref="NodePort"/> to another </summary>
        /// <param name="port">The <see cref="NodePort"/> to connect to</param>
        public void Connect(INodePort port)
        {
            if (connections == null)
            {
                connections = new List <PortConnection>();
            }

            if (!ConnectionValidator.Validate(this, port))
            {
                GameLog.LogError($"{node?.GraphData.ItemName}:{Node?.ItemName}:{ItemName} Connection Error. Validation Failed");
                return;
            }

            if (port.ConnectionType == ConnectionType.Override && port.ConnectionCount != 0)
            {
                port.ClearConnections();
            }

            if (ConnectionType == ConnectionType.Override && ConnectionCount != 0)
            {
                ClearConnections();
            }

            var portNode = port.Node;

            connections.Add(new PortConnection(port, portNode.Id));

            if (!port.IsConnectedTo(this))
            {
                port.CreateConnection(nodeId, ItemName);
            }
        }
        public void RunCase(Func <FlowBuilder, IFlowNode> createNode, int errorsCount)
        {
            // Arrange
            var b = new FlowBuilder();

            var f = b.FaultHandler <MyFaultHandler>();
            var c = b.Activity <MyCancellationHandler>();

            b.WithDefaultFaultHandler(f);
            b.WithDefaultCancellationHandler(c);

            var node = createNode(b);

            b.WithInitialNode(node);

            var validator = new ConnectionValidator();

            // Act
            validator.Validate(b.CreateFlow());

            // Assert
            Assert.That(validator.Result.GetErrorsOf(node).Count(), Is.EqualTo(errorsCount));
        }