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 TestGetWeekStats()
        {
            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(5, 0, 0, 0));
            ec.RegisterExpense(type, pay1, date, "AAA");

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

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

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