예제 #1
0
        public void Months_Is_Negative()
        {
            decimal value  = 100;
            var     months = -5;

            var compoundInterest = new CompoundRate(value, Rate, months);

            Assert.Throws <Exception>(() => compoundInterest.ReturnValue);
        }
예제 #2
0
        public void Value_Ok()
        {
            decimal value  = 100;
            var     months = 5;

            var compoundInterest = new CompoundRate(value, Rate, months);

            Assert.Equal(105.10M, compoundInterest.ReturnValue);
        }
예제 #3
0
        public void Value_Is_Zero()
        {
            decimal value  = 0;
            var     months = 5;

            var compoundInterest = new CompoundRate(value, Rate, months);

            Assert.Throws <Exception>(() => compoundInterest.ReturnValue);
        }
예제 #4
0
        public void Value_Overflow()
        {
            var value  = decimal.MaxValue;
            var months = 5;

            var compoundInterest = new CompoundRate(value, Rate, months);

            Assert.Throws <OverflowException>(() => compoundInterest.ReturnValue);
        }
예제 #5
0
        public decimal Get(decimal value, double rate, int months)
        {
            var compoundRate = new CompoundRate(value, rate, months);

            return(compoundRate.ReturnValue);
        }