Esempio n. 1
0
        public void TestGetExpensesLastWeek()
        {
            ExpenseController ec = new ExpenseController();
            ExpenseType type = new ExpenseType("AAA", "aaa");
            Money money1 = new Money("EUR");
            Payment pay1 = new Payment(money1, 15);
            DateTime date = new DateTime(2012, 12, 21, 15, 30, 00);
            ec.RegisterExpense(type, pay1, date, "AAA");

            DateTime date1 = DateTime.Now;
            ec.RegisterExpense(type, pay1, date1, "BBB");

            List<Expense> list = ec.GetExpensesFromLastWeek();
            Assert.AreEqual(String.Format("Expense:\nDescription: BBB\nType: AAA - aaa\nPayment: Payment: Money\nCurrency: EUR\nAmount: 15\nDate: {0}", date1), list[0].ToString());
        }
Esempio n. 2
0
        /// <summary>
        /// List the expenses from last week
        /// </summary>
        private void ListLastWeek()
        {
            ExpenseController ec = new ExpenseController();

            Console.WriteLine(" === Expense List ===");

            List<Expense> expenses = ec.GetExpensesFromLastWeek();
            int i = 0;
            foreach (Expense item in expenses)
            {
                Console.WriteLine(i);
                Console.WriteLine(item);
                Console.WriteLine("---\n");
                i++;
            }
        }