Example #1
0
        //click delete button
        private void ClickCategoryDeleteButton(object sender, EventArgs e)
        {
            const string MSG_CONTENT = "Do you want to delete?";
            const string MSG_TITLE   = "Delete Category";

            _categoryPModel.Delete(_listBoxCategories.SelectedIndex, MessageBox.Show(MSG_CONTENT, MSG_TITLE, MessageBoxButtons.YesNo));
        }
 public void TestDelete()
 {
     EZMoneyModel ezMoneyModel = new EZMoneyModel(); // TODO: 初始化為適當值
     ezMoneyModel.GetCategories().Clear();
     ezMoneyModel.GetRecords().Clear();
     CategoryPresentationModel categoryPModel = new CategoryPresentationModel(ezMoneyModel); // TODO: 初始化為適當值
     categoryPModel.Add(CATEGORY_NAME_MOVIE);
     categoryPModel.Add(CATEGORY_NAME_WORK);
     Assert.AreEqual(2, ezMoneyModel.GetCategories().Count);
     categoryPModel.Delete(1, DialogResult.No);// (CATEGORY_NAME_WORK);
     Assert.AreEqual(2, ezMoneyModel.GetCategories().Count);
     categoryPModel.Delete(1, DialogResult.Yes);// (CATEGORY_NAME_WORK);
     Assert.AreEqual(1, ezMoneyModel.GetCategories().Count);
 }