Beispiel #1
0
        public void CalculateCompoundInterestStringValue__ShoulReturnErrorWhenInterestRateIsLessThanZero(string initialValue)
        {
            CalculateInterest calculateInterest = new CalculateInterest();
            double            interestRate      = -0.01;
            int months = 0;

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

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

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

            Assert.Equal("0,10", result);
        }
Beispiel #3
0
        public void CalculateCompoundInterestStringValue__ShoulReturnErroWhenMonthsIsZero(string initialValue)
        {
            CalculateInterest calculateInterest = new CalculateInterest();
            double            interestRate      = 0.01;
            int months = 0;

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

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

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

            Assert.Equal("[ERRO] O Valor inicial informado está em formato inválido.", result.ToString());
        }
Beispiel #5
0
        public void CalculateCompoundInterestStringValue__ShoulNotReturnErroWhenInitialValueIsValidDecimal()
        {
            CalculateInterest calculateInterest = new CalculateInterest();
            string            initialValue      = "0.01";
            double            interestRate      = 0.01;
            int months = 1;

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

            Assert.Equal("0,01", result);
        }
Beispiel #6
0
        public void CalculateCompoundInterestStringValue__ShoulReturnErroWhenInitialValueIsZero()
        {
            CalculateInterest calculateInterest = new CalculateInterest();
            string            initialValue      = "0.00";
            double            interestRate      = 0.01;
            int months = 1;

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

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