public void GetSupersetAliasStructure_NoDsBranch_ThrowsException()
        {
            JoinExpression joinExpr = new JoinExpression(TestExprFactory.GetExpression("join", ExpressionFactoryNameTarget.OperatorSymbol));

            joinExpr.AddOperand("ds_1", ModelResolvers.ExprResolver());
            joinExpr.AddOperand("ds_2", ModelResolvers.ExprResolver());

            Assert.ThrowsAny <Exception>(() => { joinExpr.GetSupersetAliasStructure(); });
        }
        public void GetSupersetAliasStructure_SupersetStructure()
        {
            for (int i = 0; i < 2; i++)
            {
                JoinExpression joinExpr = new JoinExpression(TestExprFactory.GetExpression("join", ExpressionFactoryNameTarget.OperatorSymbol));
                joinExpr.AddOperand("ds", ModelResolvers.ExprResolver());

                IExpression expr1 = ModelResolvers.ExprResolver();
                expr1.Structure = ModelResolvers.DsResolver();
                expr1.Structure.Identifiers.Add(new StructureComponent(BasicDataType.Integer, "Id1"));
                expr1.Structure.Identifiers.Add(new StructureComponent(BasicDataType.String, "Id2"));

                IExpression expr2 = ModelResolvers.ExprResolver();
                expr2.Structure = ModelResolvers.DsResolver();
                expr2.Structure.Identifiers.Add(new StructureComponent(BasicDataType.Integer, "Id1"));
                expr2.Structure.Identifiers.Add(new StructureComponent(BasicDataType.String, "Id2"));

                joinExpr.Operands["ds"].AddOperand("ds_1", expr1);
                joinExpr.Operands["ds"].AddOperand("ds_2", expr2);

                IExpression expr3 = ModelResolvers.ExprResolver();
                if (i == 1)
                {
                    expr3.Structure = ModelResolvers.DsResolver();
                    expr3.Structure.Identifiers.Add(new StructureComponent(BasicDataType.Integer, "Id1"));
                    expr3.Structure.Identifiers.Add(new StructureComponent(BasicDataType.String, "Id2"));
                    expr3.Structure.Identifiers.Add(new StructureComponent(BasicDataType.Number, "Id3"));
                    joinExpr.Operands["ds"].AddOperand("ds_3", expr3);
                }

                IDataStructure result = joinExpr.GetSupersetAliasStructure();

                if (i == 0)
                {
                    Assert.True(expr1.Structure.EqualsObj(result));
                }
                else
                {
                    Assert.True(expr3.Structure.EqualsObj(result));
                }
            }
        }