public decimal CalculateBasePrice(BasePremiumRule basePremiumRule, Calculation calculation)
        {
            var(paramDefinitions, values) = DomainAdapter.CalculationToCalculationParams(calculation);

            return((decimal) new Interpreter()
                   .Parse(basePremiumRule.BasePriceFormula, paramDefinitions.ToArray())
                   .Invoke(values.ToArray()));
        }
        public bool AppliesDiscountMarkupRuleCalculationParams(DiscountMarkupRule discountMarkupRule, Calculation calculation)
        {
            if (IsNullOrEmpty(discountMarkupRule.ApplyIfFormula))
            {
                return(true);
            }

            var(paramDefinitions, values) = DomainAdapter.CalculationToCalculationParams(calculation);
            return((bool)new Interpreter()
                   .Parse(discountMarkupRule.ApplyIfFormula, paramDefinitions.ToArray())
                   .Invoke(values.ToArray()));
        }
        public bool AppliesBasePremiumRuleCalculationParams(BasePremiumRule basePremiumRule, Cover cover, Calculation calculation)
        {
            if (cover.Code != basePremiumRule.CoverCode)
            {
                return(false);
            }

            if (IsNullOrEmpty(basePremiumRule.ApplyIfFormula))
            {
                return(true);
            }

            var(paramDefinitions, values) = DomainAdapter.CalculationToCalculationParams(calculation);
            return((bool)new Interpreter()
                   .Parse(basePremiumRule.ApplyIfFormula, paramDefinitions.ToArray())
                   .Invoke(values.ToArray()));
        }