public void TestCancel()
 {
     EZMoneyModel ezMoneyModel = new EZMoneyModel(); // TODO: 初始化為適當值
     ezMoneyModel.GetCategories().Clear();
     ezMoneyModel.GetRecords().Clear();
     CategoryPresentationModel categoryPModel = new CategoryPresentationModel(ezMoneyModel); // TODO: 初始化為適當值
     categoryPModel.SelectCategory(0);
     Assert.IsTrue(categoryPModel.IsSelectionMode);
     categoryPModel.Cancel();
     Assert.IsFalse(categoryPModel.IsSelectionMode);
 }
 public void TestChangeTextBox()
 {
     EZMoneyModel ezMoneyModel = new EZMoneyModel(); // TODO: 初始化為適當值
     ezMoneyModel.GetCategories().Clear();
     ezMoneyModel.GetRecords().Clear();
     CategoryPresentationModel categoryPModel = new CategoryPresentationModel(ezMoneyModel); // TODO: 初始化為適當值
     categoryPModel.ChangeTextBox(CATEGORY_NAME_MOVIE);
     Assert.AreEqual(CATEGORY_NAME_MOVIE, categoryPModel.CategoryNameText);
     Category category = new Category(CATEGORY_NAME_MOVIE);
     ezMoneyModel.AddCategory(category);
     categoryPModel.SelectCategory(0);
     categoryPModel.ChangeTextBox(CATEGORY_NAME_MOVIE);
     Assert.AreEqual(false, categoryPModel.IsAddEnable);
 }
 public void TestSelectCategory()
 {
     EZMoneyModel ezMoneyModel = new EZMoneyModel(); // TODO: 初始化為適當值
     ezMoneyModel.GetCategories().Clear();
     ezMoneyModel.GetRecords().Clear();
     CategoryPresentationModel categoryPModel = new CategoryPresentationModel(ezMoneyModel); // TODO: 初始化為適當值
     categoryPModel.InitializeState();
     categoryPModel.SelectCategory(-1);
     Assert.AreEqual(false, categoryPModel.IsSelectionMode);
     Assert.AreEqual(false, categoryPModel.IsModifyEnable);
     Assert.AreEqual(false, categoryPModel.IsDeleteEnable);
     Assert.AreEqual(false, categoryPModel.IsCancelEnable);
     Category category = new Category(CATEGORY_NAME_WORK);
     ezMoneyModel.AddCategory(category);
     categoryPModel.SelectCategory(0);
     Assert.AreEqual(true, categoryPModel.IsSelectionMode);
     Assert.AreEqual(true, categoryPModel.IsModifyEnable);
     Assert.AreEqual(true, categoryPModel.IsDeleteEnable);
     Assert.AreEqual(true, categoryPModel.IsCancelEnable);
     Assert.AreEqual(CATEGORY_NAME_WORK, categoryPModel.CategoryNameText);
     Assert.AreEqual(false, categoryPModel.IsAddEnable);
 }
Example #4
0
 //change categoryListBox index
 private void ChangeCategoryListIndex(object sender, EventArgs e)
 {
     _categoryPModel.SelectCategory(_listBoxCategories.SelectedIndex);
 }