Esempio n. 1
0
        /// <summary>
        /// Show the stats of the previous week and month
        /// </summary>
        private void ShowLastMonthAndWeekStats()
        {
            ExpenseController ec = new ExpenseController();

            double monthStats = ec.GetMonthStats();
            double weekStats = ec.GetWeekStats();

            Console.WriteLine("Month stats: {0}", monthStats);
            Console.WriteLine("Week stats: {0}", weekStats);
        }
Esempio n. 2
0
        public void TestGetMonthStats()
        {
            ExpenseController ec = new ExpenseController();
            ExpenseType type = new ExpenseType("AAA", "aaa");
            Money money1 = new Money("EUR");
            Payment pay1 = new Payment(money1, 15);
            DateTime date = DateTime.Now;
            date.Subtract(new TimeSpan(15, 0, 0, 0));
            ec.RegisterExpense(type, pay1, date, "AAA");

            double amount1 = ec.GetMonthStats();
            Assert.AreEqual(-15, amount1);

            Payment pay2 = new Payment(money1, 20);
            DateTime date2 = DateTime.Now.Subtract(new TimeSpan(35, 0, 0, 0));
            ec.RegisterExpense(type, pay2, date2, "BBB");

            double amount2 = ec.GetMonthStats();
            Assert.AreEqual(5, amount2);
        }