/// <summary>
        /// Gets the result collection.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <returns>ExpressionNodeCompilationResultCollection.</returns>
        protected virtual ExpressionNodeCompilationResultCollection GetResultCollection(DestinationNode node)
        {
            var result = new ExpressionNodeCompilationResultCollection();
            result.AddRange(node.ResultNodes.Select(destNode => new ExpressionNodeCompilationResult(destNode.FieldName, null)));

            return result;
        }
        private DestinationNode ToExpressionNode(DestinationFieldList destination)
        {
            var destinationNode = new DestinationNode();

            foreach (var field in destination.Fields)
            {

                if (field.ConnectorIn.Connection == null)
                    continue;

                if (field.ConnectorIn.Connection.Source == null)
                    continue;

                var resultNode = new ResultNode
                                     {
                                         FieldName = field.Name,
                                         Expression =
                                             ToExpressionNode(
                                                 field.ConnectorIn.Connection.Source.Connection.Source.Owner,
                                                 field.ConnectorIn.Connection.Source.Connection
                                             )
                                     };

                destinationNode.ResultNodes.Add(resultNode);
            }

            return destinationNode;
        }
        public void GetResultCollectionTest()
        {
            var result = new ExpressionNodeExecuterStub(Mock.Create<INodeVisitor>());
            var node = new DestinationNode();
            node.ResultNodes.Add(new ResultNode("Fieldl1", new ConstantNode(NodeDataType.Decimal, 0)));
            node.ResultNodes.Add(new ResultNode("Fieldl2", new ConstantNode(NodeDataType.Decimal, 0)));

            var results = result.GetResultCollectionPublic(node);

            Assert.AreEqual(2, results.Count);
        }
        /// <summary>
        /// Converts Destination Node to Expression.
        /// </summary>
        /// <param name="node">Destination Node to convert.</param>
        /// <returns>Universal Expression translated from Elements Expression.</returns>
        public Expression ConvertNodeToExpression(DestinationNode node)
        {
            var result = new Expression();
            result.Source = new ExpressionSource();

            result.Result = new ExpressionResult();

            var firstNode = node.ResultNodes.First();
            result.Result.In = ConvertNode(firstNode.Expression);

            return result;
        }
 /// <summary>
 /// Prepares the multiple scripts.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <returns>Dictionary{System.StringSystem.String}.</returns>
 public abstract IDictionary<string, string> PrepareMultipleScripts(DestinationNode node);
 /// <summary>
 /// Precompile the expression tree into a prepared script.
 /// </summary>
 /// <param name="node">Root node of the expression tree that should be compiled and executed.</param>
 /// <param name="parametresToReplace">String value to replace the placeholder in the script</param>
 /// <returns>Prepared script.</returns>
 public abstract string PrepareScript(DestinationNode node, IDictionary<string, string> parametresToReplace);
        public void DestinationNodeVisitTest()
        {
            var node = new DestinationNode();
            var visitor = Mock.Create<INodeVisitor>();
            Mock.Arrange(() => visitor.Visit(node)).MustBeCalled();

            node.AcceptVisitor(visitor);
        }
 public ExpressionNodeCompilationResultCollection GetResultCollectionPublic(DestinationNode node)
 {
     return this.GetResultCollection(node);
 }
 public override IDictionary<string, string> PrepareMultipleScripts(DestinationNode node)
 {
     throw new NotImplementedException();
 }
 public override string PrepareScript(DestinationNode node, IDictionary<string, string> parametresToReplace)
 {
     throw new NotImplementedException();
 }