public void TestRegisterIncome() { IncomeController ic = new IncomeController(); IncomeType type = new IncomeType("AAA", "aaa"); DateTime date = new DateTime(2012, 12, 21, 15, 30, 00); ic.RegisterIncome(type, date, 25, "AAA"); List<Income> incs = ic.GetAllIncomes(); Assert.AreEqual("Income:\nDescription: AAA\nType: AAA - aaa\nAmount: 25\nDate: 21/12/2012 15:30:00", incs[0].ToString()); }
public void TestViewBalance() { IncomeController ic = new IncomeController(); IncomeType typeI = new IncomeType("AAA", "aaa"); DateTime dateI = new DateTime(2012, 12, 21, 15, 30, 00); ic.RegisterIncome(typeI, dateI, 25, "AAA"); ExpenseController ec = new ExpenseController(); ExpenseType typeE = new ExpenseType("AAA", "aaa"); Money moneyE = new Money("EUR"); Payment payE = new Payment(moneyE, 15); DateTime dateE = new DateTime(2012, 12, 21, 15, 30, 00); ec.RegisterExpense(typeE, payE, dateE, "AAA"); BalanceController bc = new BalanceController(); double actual = bc.CalculateBalance(); Assert.AreEqual(10, actual); }
/// <summary> /// The specific method to the register income ui /// </summary> private void ShowRegisterIncome() { IncomeController ic = new IncomeController(); IncomeType type = GetIncomeType(); DateTime date = GetDate(); Console.WriteLine("Insert a description"); string description = Console.ReadLine(); double amount; Console.WriteLine("Insert Amount:"); while (!double.TryParse(Console.ReadLine(), out amount)) ; ic.RegisterIncome(type, date, amount, description); }