Example #1
0
        public void CalculateCompoundInterest_ShoulReturnErrorWhenInterestRateIsLessThanZero()
        {
            CalculateInterest calculateInterest = new CalculateInterest();
            decimal           initialValue      = 1;
            double            interestRate      = -0.01;
            int months = 0;

            var result = calculateInterest.CalculateCompoundInterest(initialValue, interestRate, months);

            Assert.Equal("[API1] - O serviço integrado retornou um valor para taxa de juros negativo.", result);
        }
Example #2
0
        public void CalculateCompoundInterest_ShoulReturn105_10()
        {
            CalculateInterest calculateInterest = new CalculateInterest();
            decimal           initialValue      = 100;
            double            interestRate      = 0.01;
            int months = 5;

            var result = calculateInterest.CalculateCompoundInterest(initialValue, interestRate, months);

            Assert.Equal($"105,10", result);
        }
Example #3
0
        public void CalculateCompoundInterest_ShoulReturnErrorWhenMonthsIsZero()
        {
            CalculateInterest calculateInterest = new CalculateInterest();
            decimal           initialValue      = 1;
            double            interestRate      = 0.01;
            int months = 0;

            var result = calculateInterest.CalculateCompoundInterest(initialValue, interestRate, months);

            Assert.Equal("[ERRO] O Valor informado no parâmetro 'meses' deve ser um número inteiro maior que zero (0).", result);
        }
Example #4
0
        public void CalculateCompoundInterest_ShoulReturnErrorWhenInitialValueIsZero()
        {
            CalculateInterest calculateInterest = new CalculateInterest();
            decimal           initialValue      = 0;
            double            interestRate      = 0.01;
            int months = 5;

            var result = calculateInterest.CalculateCompoundInterest(initialValue, interestRate, months);

            Assert.Equal("[ERRO] O Valor inicial informado deve ser um número decimal maior que zero (0).", result);
        }