Exemplo n.º 1
0
        public void GetOutputStructure_WrongComponentType(ComponentType wrongType)
        {
            IExpression expr = ModelResolvers.ExprResolver();

            expr.OperatorDefinition = ModelResolvers.OperatorResolver("sub");

            IExpression operand = TestExprFactory.GetDatasetExpr(new KeyValuePair <ComponentType, BasicDataType>(wrongType, BasicDataType.Integer));

            expr.AddOperand("ds_1", operand);

            Assert.ThrowsAny <Exception>(() => { expr.OperatorDefinition.GetOutputStructure(expr); });
        }
        public void GetOutputStructure_Wrong()
        {
            IExpression expr = ModelResolvers.ExprResolver();

            expr.OperatorDefinition = ModelResolvers.OperatorResolver("subExpr");

            IExpression compExpr  = TestExprFactory.GetDatasetExpr(new KeyValuePair <ComponentType, BasicDataType>(ComponentType.Identifier, BasicDataType.String));
            IExpression constExpr = TestExprFactory.GetDatasetExpr(new KeyValuePair <ComponentType, BasicDataType>(ComponentType.Measure, BasicDataType.Integer));

            expr.AddOperand("ds_1", compExpr);
            expr.AddOperand("ds_2", constExpr);

            Assert.ThrowsAny <Exception>(() => { expr.OperatorDefinition.GetOutputStructure(expr); });
        }
Exemplo n.º 3
0
        public void GetOutputStructure_Correct1Operand()
        {
            IExpression expr = ModelResolvers.ExprResolver();

            expr.OperatorDefinition = ModelResolvers.OperatorResolver("sub");

            IExpression operand = TestExprFactory.GetDatasetExpr(new KeyValuePair <ComponentType, BasicDataType>(ComponentType.Identifier, BasicDataType.Integer));

            expr.AddOperand("ds_1", operand);

            IDataStructure dataStructure = expr.OperatorDefinition.GetOutputStructure(expr);

            Assert.True(operand.Structure.EqualsObj(dataStructure));
        }
        public void GetOutputStructure_Correct()
        {
            IExpression expr = ModelResolvers.ExprResolver();

            expr.OperatorDefinition = ModelResolvers.OperatorResolver("subExpr");

            IExpression compExpr  = TestExprFactory.GetDatasetExpr(new KeyValuePair <ComponentType, BasicDataType>(ComponentType.Identifier, BasicDataType.String));
            IExpression constExpr = TestExprFactory.GetDatasetExpr(new KeyValuePair <ComponentType, BasicDataType>(ComponentType.Measure, BasicDataType.String));

            expr.AddOperand("ds_1", compExpr);
            expr.AddOperand("ds_2", constExpr);

            IDataStructure dataStructure = expr.OperatorDefinition.GetOutputStructure(expr);

            Assert.True(dataStructure.Identifiers.Count == 1);
            Assert.True(dataStructure.Components.Count == 1);
            Assert.True(dataStructure.Identifiers.First().ComponentName == compExpr.Structure.Identifiers.First().ComponentName);
            Assert.True(dataStructure.Identifiers.First().ValueDomain.DataType == constExpr.Structure.Measures.First().ValueDomain.DataType);
        }