Ejemplo n.º 1
0
        private Expression CreateExpressionFromSelectionPack(SelectConditionPack selectConditionPack,
                                                             ParameterExpression parameter)
        {
            var _expressionBuilder =
                _logicConditionStrategy.GetExpressionBuilder(selectConditionPack.JoinCondition);
            Expression _finalExpression = _expressionBuilder.Start();

            foreach (SelectConditionPack _selectConditionPack in selectConditionPack.SelectConditionPacks)
            {
                var _expression = CreateExpressionFromSelectionPack(_selectConditionPack, parameter);
                _finalExpression = _expressionBuilder.Build(_finalExpression, _expression);
            }

            foreach (SelectCondition _selectCondition in selectConditionPack.SelectConditions)
            {
                var _expression = CreateExpressionFromCondition(parameter, _selectCondition);
                _finalExpression = _expressionBuilder.Build(_finalExpression, _expression);
            }

            if (selectConditionPack.Not)
            {
                _finalExpression = Expression.Not(_finalExpression);
            }

            return(_finalExpression);
        }
Ejemplo n.º 2
0
        public void Match(Type expressionBuilderType, LogicCondition condition)
        {
            // Array

            // Act
            var _expressionBuilder = _strategy.GetExpressionBuilder(condition);

            // Assert
            Assert.IsInstanceOf(expressionBuilderType, _expressionBuilder);
        }