public void TestCancel()
 {
     EZMoneyModel ezMoneyModel = new EZMoneyModel(); // TODO: 初始化為適當值
     RecordPresentationModel recordPModel = new RecordPresentationModel(ezMoneyModel); // TODO: 初始化為適當值
     RecordModel recordModel = ezMoneyModel.RecordModel;
     CategoryModel categoryModel = ezMoneyModel.CategoryModel;
     recordModel.Records.Clear();
     categoryModel.Categories.Clear();
     Category category = new Category(CATEGORY_NAME_MOVIE);
     categoryModel.AddCategory(category);
     DateTime date = DateTime.Now; // TODO: 初始化為適當值
     Record record = new Record(date, category, 100);
     recordModel.AddRecord(record);
     recordPModel.SelectRecord(0);
     Assert.AreEqual(true, recordPModel.IsSelectionMode);
     recordPModel.Cancel();
     Assert.AreEqual(false, recordPModel.IsSelectionMode);
 }
Beispiel #2
0
        public void TestCancel()
        {
            EZMoneyModel            ezMoneyModel  = new EZMoneyModel();                        // TODO: 初始化為適當值
            RecordPresentationModel recordPModel  = new RecordPresentationModel(ezMoneyModel); // TODO: 初始化為適當值
            RecordModel             recordModel   = ezMoneyModel.RecordModel;
            CategoryModel           categoryModel = ezMoneyModel.CategoryModel;

            recordModel.Records.Clear();
            categoryModel.Categories.Clear();
            Category category = new Category(CATEGORY_NAME_MOVIE);

            categoryModel.AddCategory(category);
            DateTime date   = DateTime.Now; // TODO: 初始化為適當值
            Record   record = new Record(date, category, 100);

            recordModel.AddRecord(record);
            recordPModel.SelectRecord(0);
            Assert.AreEqual(true, recordPModel.IsSelectionMode);
            recordPModel.Cancel();
            Assert.AreEqual(false, recordPModel.IsSelectionMode);
        }
Beispiel #3
0
        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 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);
 }