public void GivenPrincipal10ExpectAbount10()
        {
            double           P        = 0.0;
            CompoundInterest ci       = new CompoundInterest();
            double           actual   = ci.getAmount(P, 1, 1, 1);
            double           expected = 0;

            Assert.Equal(expected, actual);
        }
        public void GivenNegativePrincipalThrowException()
        {
            double           P  = -1.0;
            CompoundInterest ci = new CompoundInterest();
            Exception        ex = Assert.Throws <Exception>(
                () => ci.getAmount(P, 1, 1, 1)
                );
            string actual   = ex.Message;
            string expected = "The principal cannot be negative number.";

            Assert.Equal(expected, actual);
        }
        public void GivenParametersExpectAmount()
        {
            double           P        = 5000;
            double           r        = 0.05;
            double           n        = 12.0;
            double           t        = 10.0;
            CompoundInterest ci       = new CompoundInterest();
            double           actual   = Math.Round(ci.getAmount(P, r, n, t), 1);// round to 2 decimal places
            double           expected = 8235.0;

            Assert.Equal(expected, actual);
        }
        public void GivenNagativeYearThrowException()
        {
            double           t  = -1.0;
            CompoundInterest ci = new CompoundInterest();
            Exception        ex = Assert.Throws <Exception>(
                () => ci.getAmount(1, 1, 1, t)
                );
            string actual   = ex.Message;
            string expected = "The number of year cannot be negative number.";

            Assert.Equal(expected, actual);
        }
        public void GivenDivideNBy0ThrowException()
        {
            double           n  = 0.0;
            CompoundInterest ci = new CompoundInterest();
            Exception        ex = Assert.Throws <Exception>(
                () => ci.getAmount(1, 1, n, 1)
                );
            string actual   = ex.Message;
            string expected = "The number of times cannot divide by 0 time.";

            Assert.Equal(expected, actual);
        }