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 TestSetErrorProvider()
 {
     EZMoneyModel ezMoneyModel = new EZMoneyModel(); // TODO: 初始化為適當值
     ezMoneyModel.GetCategories().Clear();
     ezMoneyModel.GetRecords().Clear();
     RecordPresentationModel recordPModel = new RecordPresentationModel(ezMoneyModel); // TODO: 初始化為適當值
     Category category = new Category(CATEGORY_NAME_WORK);
     ezMoneyModel.AddCategory(category);
     recordPModel.InitializeState();
     const String FIFTY = "50";
     recordPModel.ChangeAmount(FIFTY);
     recordPModel.SetErrorProvider();
     Assert.AreEqual(RecordPresentationModel.NO_SELECT_CATEGORY_INFO, recordPModel.ErrorProviderMessage);
     recordPModel.SelectCategory(0);
     Assert.AreEqual(RecordPresentationModel.EMPTY_ERROR_MESSAGE, recordPModel.ErrorProviderMessage);
 }
 public void TestRaiseUpdateEvent()
 {
     EZMoneyModel ezMoneyModel = new EZMoneyModel(); // TODO: 初始化為適當值
     ezMoneyModel.GetCategories().Clear();
     ezMoneyModel.GetRecords().Clear();
     RecordPresentationModel recordPModel = new RecordPresentationModel(ezMoneyModel); // TODO: 初始化為適當值
     int raiseCount = 0;
     recordPModel._updateEvent += delegate(RecordPresentationModel localRecordPModel)
     {
         raiseCount++;
     };
     DateTime date = DateTime.Now;
     Category category = new Category(CATEGORY_NAME_MOVIE);
     ezMoneyModel.AddCategory(category);
     const String FIFTY = "50";
     recordPModel.Add(date, 0, FIFTY);
     Assert.AreEqual(1, raiseCount);
     recordPModel.Cancel();
     Assert.AreEqual(2, raiseCount);
 }
 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);
 }
 public void TestModify()
 {
     EZMoneyModel ezMoneyModel = new EZMoneyModel(); // TODO: 初始化為適當值
     ezMoneyModel.GetCategories().Clear();
     ezMoneyModel.GetRecords().Clear();
     CategoryPresentationModel categoryPModel = new CategoryPresentationModel(ezMoneyModel); // TODO: 初始化為適當值
     categoryPModel.InitializeState();
     Category category = new Category(CATEGORY_NAME_WORK);
     ezMoneyModel.AddCategory(category);
     Assert.AreEqual(CATEGORY_NAME_WORK, ezMoneyModel.GetCategories()[0].CategoryName);
     categoryPModel.Modify(0, CATEGORY_NAME_MOVIE);
     Assert.AreEqual(CATEGORY_NAME_MOVIE, ezMoneyModel.GetCategories()[0].CategoryName);
 }
 public void TestIsValidCategoryAdd()
 {
     EZMoneyModel ezMoneyModel = new EZMoneyModel(); // TODO: 初始化為適當值
     ezMoneyModel.GetCategories().Clear();
     ezMoneyModel.GetRecords().Clear();
     CategoryPresentationModel categoryPModel = new CategoryPresentationModel(ezMoneyModel); // TODO: 初始化為適當值
     categoryPModel.InitializeState();
     string errorMessage = string.Empty;
     Assert.IsTrue(categoryPModel.IsValidCategoryAdd(CATEGORY_NAME_WORK, ref errorMessage));
     Assert.AreEqual(String.Empty, errorMessage);
     Assert.IsFalse(categoryPModel.IsValidCategoryAdd(String.Empty, ref errorMessage));
     Assert.AreEqual(CategoryPresentationModel.CATEGORY_NO_NAME_INFO, errorMessage);
     Category category = new Category(CATEGORY_NAME_WORK);
     ezMoneyModel.AddCategory(category);
     Assert.IsFalse(categoryPModel.IsValidCategoryAdd(CATEGORY_NAME_WORK, ref errorMessage));
     Assert.AreEqual(CategoryPresentationModel.CATEGORY_REPEAT_INFO, errorMessage);
 }