Here are the examples of the csharp api class Code.FinancialDesignPatterns.IRule.Calculate(System.Collections.Generic.List) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

View license
public EngineResult<TEntry, TConsumption> Calculate<TEntry, TConsumption>(
            List<TEntry> items,
            List<IRule<TEntry, TConsumption>> rules) {

            var unconsumed = items.Select(x => new ConsumedInfo<TEntry, TConsumption>(x)).ToList();

            var result = new EngineResult<TEntry, TConsumption>();

            foreach (var rule in rules) {
                if (!unconsumed.Any())

                var partResult = rule.Calculate(unconsumed);

                result.Billed.Add(new RuleBilling<TEntry, TConsumption>() { AppliedRule = rule, Billed = partResult.Billed });
                unconsumed = partResult.UnconsumedBillableEntities;

            result.UnconsumedEntities = unconsumed;

            return result;