public async Task <decimal> CalculateCompoundInterest(decimal initialValue, int time, decimal interestRate)
        {
            var compoundInterest = new CompoundInterest
            {
                InitialValue = initialValue,
                Time         = time,
                InterestRate = interestRate
            };

            return(await Task.FromResult(compoundInterest.CalculateCompoundInterest(2)));
        }
Exemple #2
0
        public void CalculateCompoundInterest_Correto()
        {
            var compoundInterest = new CompoundInterest
            {
                InitialValue = 100M,
                InterestRate = 0.01M,
                Time         = 5
            };
            var result = compoundInterest.CalculateCompoundInterest(2);

            Assert.Equal(105.1M, result);
        }
Exemple #3
0
        public void CalculateCompoundInterest_SemTruncate()
        {
            var compoundInterest = new CompoundInterest
            {
                InitialValue = 100M,
                InterestRate = 0.01M,
                Time         = 5
            };
            var result = compoundInterest.CalculateCompoundInterest(null);

            Assert.Equal(105.1010050100M, result);
        }