Example #1
0
        public static Super Generate(string superRate, IGrossIncome grossIncome)
        {
            if (string.IsNullOrWhiteSpace(superRate))
            {
                throw new Exception("Super must be greater than 0");
            }

            if (superRate.Contains('%'))
            {
                var indexOfPercentageSign = superRate.IndexOf('%');
                superRate = superRate.Substring(0, indexOfPercentageSign);
            }

            var superRateAsANumber = ConvertSuperStringToNumber(superRate);

            var superOverPeriod = SuperCalculator.GetSuper(superRateAsANumber, grossIncome);

            return(new Super {
                Amount = superOverPeriod
            });
        }