Exemplo n.º 1
0
        public void Principal0Amount0()
        {
            FizzBuzz fb       = new FizzBuzz();
            double   actual   = fb.getCompoundInterest(0, 1, 3, 5);
            double   expected = 0;

            Assert.Equal(expected, actual);
        }
Exemplo n.º 2
0
        public void Principal5000Amount10()
        {
            FizzBuzz fb       = new FizzBuzz();
            double   actual   = fb.getCompoundInterest(5000, 0.05, 12, 10);
            double   expected = 8235.0474884514;

            Assert.Equal(expected, actual);
        }
Exemplo n.º 3
0
        public void NegativePrincipalException()
        {
            FizzBuzz  fb = new FizzBuzz();
            Exception ex = Assert.Throws <Exception>(
                () => fb.getCompoundInterest(-100, 8, 3, 8)
                );
            string expected = "Principal cannot be less than 0";
            string actual   = ex.Message;

            Assert.Equal(expected, actual);
        }
Exemplo n.º 4
0
        public void NegativeInterestRateException()
        {
            FizzBuzz  fb = new FizzBuzz();
            Exception ex = Assert.Throws <Exception>(
                () => fb.getCompoundInterest(0, -1, 3, 5)
                );
            string expected = "Interest Rate cannot be less than 0";
            string actual   = ex.Message;

            Assert.Equal(expected, actual);
        }
Exemplo n.º 5
0
        public void DivideByZeroExceptionInterestRate()
        {
            FizzBuzz  fb = new FizzBuzz();
            Exception ex = Assert.Throws <System.DivideByZeroException>(
                () => fb.getCompoundInterest(0, 0, 3, 0)
                );
            string expected = "Attempted to divide by zero.";
            string actual   = ex.Message;

            Assert.Equal(expected, actual);
        }