public void Build_AggrAnalyticOperatorExpr_Expr()
        {
            List <string> opSymbols = new List <string>(AggrFunctionOperator.Symbols);

            opSymbols.AddRange(AnalyticFunctionOperator.Symbols);

            foreach (string opSymbol in opSymbols)
            {
                ApplyBranch applyBranch = new ApplyBranch(ModelResolvers.ExprResolver, this._exprTextGenerator);

                Mock <IOperatorDefinition> opDefMock = new Mock <IOperatorDefinition>();
                opDefMock.SetupGet(opDef => opDef.Symbol).Returns(opSymbol);
                opDefMock.Setup(opDef => opDef.GetOutputStructure(It.IsAny <IExpression>()))
                .Returns((IExpression expr) => { return(ModelResolvers.DsResolver()); });

                IExpression expr = TestExprFactory.GetExpression(opSymbol, ExpressionFactoryNameTarget.OperatorSymbol);
                expr.OperatorDefinition = opDefMock.Object;
                expr.AddOperand("ds", ModelResolvers.ExprResolver());
                expr.AddOperand("group", ModelResolvers.ExprResolver());
                expr.AddOperand("having", ModelResolvers.ExprResolver());
                expr.AddOperand("over", ModelResolvers.ExprResolver());

                IExpression result = applyBranch.Build(expr);

                Assert.NotNull(result.Structure);
                Assert.Equal("Generated text", result.ExpressionText);
                Assert.Equal("Apply", result.ResultName);
                Assert.Equal("apply", result.ParamSignature);
                Assert.Equal(expr.OperatorSymbol, result.OperatorSymbol);
                Assert.Equal(1, result.OperandsCollection.Count);
                Assert.True(result.Operands.ContainsKey("ds"));
            }
        }
        public void Build_NotAggrAnalyticOperatorExpr_Expr(string opSymbol)
        {
            ApplyBranch applyBranch = new ApplyBranch(ModelResolvers.ExprResolver, this._exprTextGenerator);

            Mock <IOperatorDefinition> opDefMock = new Mock <IOperatorDefinition>();

            opDefMock.SetupGet(opDef => opDef.Symbol).Returns(opSymbol);
            opDefMock.Setup(opDef => opDef.GetOutputStructure(It.IsAny <IExpression>()))
            .Returns((IExpression expr) => { return(ModelResolvers.DsResolver()); });

            IExpression expr = TestExprFactory.GetExpression(opSymbol, ExpressionFactoryNameTarget.OperatorSymbol);

            expr.OperatorDefinition = opDefMock.Object;
            expr.AddOperand("ds", ModelResolvers.ExprResolver());
            expr.AddOperand("group", ModelResolvers.ExprResolver());
            expr.AddOperand("having", ModelResolvers.ExprResolver());
            expr.AddOperand("over", ModelResolvers.ExprResolver());

            IExpression result = applyBranch.Build(expr);

            Assert.NotNull(result.Structure);
            Assert.Equal("Generated text", result.ExpressionText);
            Assert.Equal("Apply", result.ResultName);
            Assert.Equal("apply", result.ParamSignature);
            Assert.Equal(expr.OperatorSymbol, result.OperatorSymbol);
            Assert.Equal(expr.OperandsCollection.Count, result.OperandsCollection.Count);

            for (int i = 0; i < expr.OperandsCollection.Count; i++)
            {
                Assert.Equal(expr.OperandsCollection.ToArray()[i].ParamSignature, result.OperandsCollection.ToArray()[i].ParamSignature);
            }
        }