public void CapitalPaymentShouldThrowExceptionWhenPeriodIsLessOrEqualToZero()
        {
            //Act
            var exception = Record.Exception(() => FinancialCalculations.CapitalPayment(1.2, 0, 60, 60000, 0, DueDate.EndOfPeriod));

            //Assert
            exception.Should().NotBeNull();
        }
        public void CapitalPaymentShouldCalculatedWithoutError()
        {
            //Act
            var exception = Record.Exception(() => FinancialCalculations.CapitalPayment(1.4, 48, 60, 60000, 0, DueDate.EndOfPeriod));

            //Assert
            exception.Should().BeNull();
        }
Ejemplo n.º 3
0
        public void CapitalPaymentShouldCalculateCorrectly(double rate, short numberPeriods, double presentValue, double futureValue,
                                                           DueDate due)
        {
            //Act
            var correctSut = Math.Abs(Financial.CumPrinc(rate, numberPeriods, presentValue, 1, 1, PaymentDue.EndOfPeriod));
            var sut        = Math.Abs(FinancialCalculations.CapitalPayment(rate, 1, numberPeriods, presentValue, futureValue, due));

            var isEqual = TestHelper.IsEqualDoubles(sut, correctSut);

            //Assert
            isEqual.Should().BeTrue();
        }