Example #1
0
        /// <summary>
        /// Executes (evaluates) decision with given <paramref name="decisionName"/>
        /// </summary>
        /// <param name="decisionName">Name of the decision to execute</param>
        /// <returns>Decision result</returns>
        /// <exception cref="ArgumentException"><paramref name="decisionName"/> is null or empty</exception>
        /// <exception cref="DmnExecutorException">Decision with <paramref name="decisionName"/> not found</exception>
        public DmnDecisionResult ExecuteDecision(string decisionName)
        {
            if (string.IsNullOrWhiteSpace(decisionName))
            {
                throw Logger.Fatal <ArgumentException>($"{nameof(decisionName)} is null or empty");
            }
            if (!Decisions.ContainsKey(decisionName))
            {
                throw Logger.Fatal <DmnExecutorException>($"ExecuteDecision: - decision {decisionName} not found");
            }

            var decision = Decisions[decisionName];

            return(ExecuteDecision(decision));
        }