void GetFirstHandler()
        {
            var salaryRateHandlers = _configService.GetSection <SalaryRateHandlers>(nameof(SalaryRateHandlers));

            for (int i = 0; i < salaryRateHandlers.SalaryRateHandlerList.Count() - 1; i++)
            {
                salaryRateHandlers.SalaryRateHandlerList.ElementAt(i).SetNextHandler(salaryRateHandlers.SalaryRateHandlerList.ElementAt(i + 1));
            }

            salaryRateHandler = salaryRateHandlers.SalaryRateHandlerList.First();
        }
Example #2
0
        public IEnumerable <OutputModel> CalculateSalary(IEnumerable <InputModel> inputs, SalaryRateHandler salaryRate)
        {
            OutputModel output = null;

            if (inputs == null || inputs.Count() == 0 || salaryRate == null)
            {
                yield return(null);
            }

            foreach (var input in inputs)
            {
                try
                {
                    output = salaryRate.CalculateSalary(input);
                }
                catch
                {
                    //  throw;
                }
                yield return(output);
            }
        }