private void InitViewTests() { _mortgage = TestBudget.Budget.MasterCategories.SelectMany(c => c.Categories).Single(sc => sc.Name == "Mortgage"); _electricity = TestBudget.Budget.MasterCategories.SelectMany(c => c.Categories).Single(sc => sc.Name == "Electricity"); _previousMonth = _mortgage.CategoryMonths.GetCategoryMonth(DateTime.Today.FirstDayOfMonth().AddMonths(-1)); _previousMonth.AmountBudgeted = 150; _checking = TestBudget.Budget.Accounts.Single(a => a.Name == "Checking"); _checking.Transactions.Add(new Transaction() { IncomeCategory = TestBudget.Budget.IncomeCategories.GetIncomeCategory(DateTime.Today.FirstDayOfMonth().AddMonths(-1)), TransactionDate = DateTime.Today.FirstDayOfMonth().AddMonths(-1), Amount = 300 }); AddTransaction(-100, -1); _thisMonth = _mortgage.CategoryMonths.GetCategoryMonth(DateTime.Today.FirstDayOfMonth()); _thisMonth.AmountBudgeted = 150; AddTransaction(-100, 0); TestBudget.BudgetModel.SaveChanges(); TestBudget.TestEvents.Clear(); }
public void TearDown() { TestBudget?.BudgetModel?.Dispose(); TestBudget = null; _electricity = null; _previousMonth = null; _thisMonth = null; _mortgage = null; _checking = null; }
public CategoryMonthView(Category subCategory, DateTime date) { if (subCategory == null) { throw new ArgumentNullException(nameof(subCategory)); } Category = subCategory; _model = Category.Model; _firstDayOfMonth = date.FirstDayOfMonth().Date; _lastDayOfMonth = _firstDayOfMonth.LastDayOfMonth().Date; _cache = _model.BudgetViewCache; CategoryMonth = Category.CategoryMonths.GetCategoryMonth(_firstDayOfMonth); CategoryMonth.PropertyChanged += CategoryMonth_PropertyChanged; RefreshValues(); _cache.CacheUpdated += Cache_CacheUpdated; }
public CategoryMonthNoteEditorViewModel(CategoryMonth categoryMonth) { SaveNoteCommand = new RelayCommand(SaveNote); CloseEditorCommand = new RelayCommand(CloseEditor); CategoryMonth = categoryMonth; }