public void BudgetMonthView_NegativeBalanceHandling_HandlingTypeCarriedForwardOnceSet() { DateTime thisMonthDate = DateTime.Today.FirstDayOfMonth(); DateTime nextMonthDate = DateTime.Today.FirstDayOfMonth().AddMonths(1); DateTime thirdMonthDate = DateTime.Today.FirstDayOfMonth().AddMonths(2); AddTransaction(-150, 0); BudgetMonthView thisMonthView = new BudgetMonthView(TestBudget.BudgetModel, thisMonthDate); BudgetMonthView nextMonthView = new BudgetMonthView(TestBudget.BudgetModel, nextMonthDate); BudgetMonthView thirdMonthView = new BudgetMonthView(TestBudget.BudgetModel, thirdMonthDate); var mortgageThisMonth = new CategoryMonthView(_mortgage, thisMonthDate); mortgageThisMonth.CategoryMonth.NegativeBalanceHandling = NegativeBalanceHandlingTypes.CarryForwardBalance; TestBudget.SaveChanges(); Assert.That(mortgageThisMonth.CategoryMonth.NegativeBalanceHandling, Is.Not.Null); Assert.That(mortgageThisMonth.CategoryMonth.NegativeBalanceHandling, Is.EqualTo(NegativeBalanceHandlingTypes.CarryForwardBalance)); var mortgageNextMonth = new CategoryMonthView(_mortgage, nextMonthDate); Assert.That(mortgageNextMonth.CategoryMonth.NegativeBalanceHandling, Is.Null); Assert.That(mortgageNextMonth.NegativeBalanceHandling, Is.EqualTo(NegativeBalanceHandlingTypes.CarryForwardBalance)); var mortgateThirdMonth = new CategoryMonthView(_mortgage, thirdMonthDate); Assert.That(mortgateThirdMonth.CategoryMonth.NegativeBalanceHandling, Is.Null); Assert.That(mortgateThirdMonth.NegativeBalanceHandling, Is.EqualTo(NegativeBalanceHandlingTypes.CarryForwardBalance)); }
public void CategoryMonthView_ValuesAreCorrect_After_AddSplitTransaction() { CategoryMonthView mortgageView = new CategoryMonthView(_mortgage, DateTime.Today); Assert.That(mortgageView.BeginningBalance, Is.EqualTo(50)); Assert.That(mortgageView.EndBalance, Is.EqualTo(100)); CategoryMonthView electricityView = new CategoryMonthView(_electricity, DateTime.Today); Assert.That(electricityView.BeginningBalance, Is.EqualTo(0)); Assert.That(electricityView.EndBalance, Is.EqualTo(0)); var transaction = new Transaction(); transaction.Amount = -100; transaction.MakeSplitTransaction(); transaction.TransactionDate = DateTime.Today.FirstDayOfMonth(); var sub1 = transaction.SubTransactions.Create(); sub1.Category = _mortgage; sub1.Amount = -50; var sub2 = transaction.SubTransactions.Create(); sub2.Category = _electricity; sub2.Amount = -50; _checking.Transactions.Add(transaction); TestBudget.SaveChanges(); Assert.That(mortgageView.EndBalance, Is.EqualTo(50)); Assert.That(electricityView.EndBalance, Is.EqualTo(-50)); }
public void CategoryMonth_ValuesAreCorrect_OnInit() { CategoryMonthView view = new CategoryMonthView(_mortgage, DateTime.Today); Assert.That(view.BeginningBalance, Is.EqualTo(50)); Assert.That(view.AmountBudgeted, Is.EqualTo(150)); Assert.That(view.EndBalance, Is.EqualTo(100)); Assert.That(view.TransactionsInMonth, Is.EqualTo(-100)); }
public void CategoryMonthView_ValuesAreCorrect_After_AddPreviousMonthTransaction() { CategoryMonthView view = new CategoryMonthView(_mortgage, DateTime.Today); Assert.That(view.BeginningBalance, Is.EqualTo(50)); Assert.That(view.EndBalance, Is.EqualTo(100)); AddTransaction(-10, -1); Assert.That(view.BeginningBalance, Is.EqualTo(40)); Assert.That(view.EndBalance, Is.EqualTo(90)); }
public void CategoryMonthView_ValuesAreCorrect_After_PreviousMonthCategoryChange() { var transaction = AddTransaction(-10, -1, _electricity); CategoryMonthView view = new CategoryMonthView(_mortgage, DateTime.Today); Assert.That(view.BeginningBalance, Is.EqualTo(50)); Assert.That(view.EndBalance, Is.EqualTo(100)); transaction.TransactionCategory = _mortgage; TestBudget.SaveChanges(); Assert.That(view.BeginningBalance, Is.EqualTo(40)); Assert.That(view.EndBalance, Is.EqualTo(90)); }
public void BudgetMonthView_NegativeBalanceHandling_IsAvailableToBudgetByDefault() { DateTime thisMonthDate = DateTime.Today.FirstDayOfMonth(); DateTime nextMonthDate = DateTime.Today.FirstDayOfMonth().AddMonths(1); AddTransaction(-150, 0); BudgetMonthView thisMonthView = new BudgetMonthView(TestBudget.BudgetModel, thisMonthDate); BudgetMonthView nextMonthView = new BudgetMonthView(TestBudget.BudgetModel, nextMonthDate); var mortgageThisMonth = new CategoryMonthView(_mortgage, thisMonthDate); var mortgageNextMonth = new CategoryMonthView(_mortgage, nextMonthDate); //Negative Balance Handling is not explicit, but is assumed to be Availble To Budget By Default Assert.That(mortgageThisMonth.CategoryMonth.NegativeBalanceHandling, Is.Null); Assert.That(mortgageThisMonth.NegativeBalanceHandling, Is.EqualTo(NegativeBalanceHandlingTypes.AvailableToBudget)); }
public void CategoryMonthView_ValuesAreCorrect_After_PreviousMonthAmountChange() { CategoryMonthView view = new CategoryMonthView(_mortgage, DateTime.Today); var transaction = _checking.Transactions[1]; transaction.Amount = -120; TestBudget.SaveChanges(); Assert.That(view.BeginningBalance, Is.EqualTo(30)); Assert.That(view.EndBalance, Is.EqualTo(80)); transaction.Amount = -100; TestBudget.SaveChanges(); Assert.That(view.BeginningBalance, Is.EqualTo(50)); Assert.That(view.EndBalance, Is.EqualTo(100)); }
public void BudgetMonthView_NegativeBalanceHandling_CarryForwardBalance() { DateTime thisMonthDate = DateTime.Today.FirstDayOfMonth(); DateTime nextMonthDate = DateTime.Today.FirstDayOfMonth().AddMonths(1); AddTransaction(-150, 0); BudgetMonthView thisMonthView = new BudgetMonthView(TestBudget.BudgetModel, thisMonthDate); BudgetMonthView nextMonthView = new BudgetMonthView(TestBudget.BudgetModel, nextMonthDate); var mortgageThisMonth = new CategoryMonthView(_mortgage, thisMonthDate); mortgageThisMonth.CategoryMonth.NegativeBalanceHandling = NegativeBalanceHandlingTypes.CarryForwardBalance; TestBudget.SaveChanges(); var mortgageNextMonth = new CategoryMonthView(_mortgage, nextMonthDate); Assert.That(mortgageThisMonth.NegativeBalanceHandling, Is.EqualTo(NegativeBalanceHandlingTypes.CarryForwardBalance)); Assert.That(mortgageThisMonth.EndBalance, Is.EqualTo(-50)); Assert.That(nextMonthView.OverspentPreviousMonth, Is.EqualTo(0M)); Assert.That(mortgageNextMonth.BeginningBalance, Is.EqualTo(-50)); Assert.That(mortgageNextMonth.EndBalance, Is.EqualTo(-50)); }
public CategoryMonthViewModel(BudgetMonthViewModel budgetMonthViewModel, CategoryRowViewModel categoryRowViewModel, CategoryMonthView monthView) { BudgetMonthViewModel = budgetMonthViewModel; CategoryRowViewModel = categoryRowViewModel; CategoryMonthView = monthView; }
private void UnmountCategoryMonthView(CategoryMonthView obj) { obj.PropertyChanged -= MonthView_PropertyChanged; }
private void MountCategoryMonthView(CategoryMonthView obj) { obj.PropertyChanged += MonthView_PropertyChanged; NoteEditor = new CategoryMonthNoteEditorViewModel(obj.CategoryMonth); }