Esempio n. 1
0
        public int Process()
        {
            var denList   = new List <Denomination>();
            var inputData = _input.LoadData();

            foreach (var transaction in inputData)
            {
                IReducer         reducer   = GetReducer((int)transaction.AmountOwed);
                IChangeGenerator generator = new ChangeGenerator();//
                var result = generator.ComputeChange(transaction.AmountChangeCents, (list) =>
                {
                    return(reducer.Reduce(list));
                });
                denList.Add(result);
            }
            if (denList.Any())
            {
                _output.SaveData(denList);
            }

            return(denList.Count);
        }