예제 #1
0
        public void TestChangeAmount()
        {
            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);
            const String AMOUNT_ORIGIN = "100";
            const string AMOUNT_AFTER  = "200";

            Assert.AreEqual(AMOUNT_ORIGIN, recordPModel.Amount);
            recordPModel.ChangeAmount(AMOUNT_AFTER);
            Assert.AreEqual(AMOUNT_AFTER, recordPModel.Amount);
            recordPModel.IsSelectionMode = false;
            recordPModel.ChangeAmount(AMOUNT_AFTER);
            Assert.AreEqual(AMOUNT_AFTER, recordPModel.Amount);
        }
예제 #2
0
        public void TestSelectRecord()
        {
            EZMoneyModel            ezMoneyModel  = new EZMoneyModel();                        // TODO: 初始化為適當值
            RecordPresentationModel recordPModel  = new RecordPresentationModel(ezMoneyModel); // TODO: 初始化為適當值
            RecordModel             recordModel   = ezMoneyModel.RecordModel;
            CategoryModel           categoryModel = ezMoneyModel.CategoryModel;

            recordPModel.InitializeState();
            Category category = new Category(CATEGORY_NAME_WORK);

            categoryModel.AddCategory(category);
            DateTime date = DateTime.Now;

            recordModel.AddRecord(date, ref category, 100);
            recordModel.AddRecord(date, ref category, -100);
            recordPModel.SelectRecord(0);
            Assert.AreEqual(0, recordPModel.RecordIndex);
            recordPModel.SelectRecord(1);
            Assert.AreEqual(1, recordPModel.RecordIndex);
            recordPModel.SelectRecord(-1);
            Assert.IsFalse(recordPModel.IsSelectionMode);
        }
 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);
 }
예제 #4
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);
        }
 public void TestChangeAmount()
 {
     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);
     const String AMOUNT_ORIGIN = "100";
     const string AMOUNT_AFTER = "200";
     Assert.AreEqual(AMOUNT_ORIGIN, recordPModel.Amount);
     recordPModel.ChangeAmount(AMOUNT_AFTER);
     Assert.AreEqual(AMOUNT_AFTER, recordPModel.Amount);
     recordPModel.IsSelectionMode = false;
     recordPModel.ChangeAmount(AMOUNT_AFTER);
     Assert.AreEqual(AMOUNT_AFTER, recordPModel.Amount);
 }
 public void TestSelectRecord()
 {
     EZMoneyModel ezMoneyModel = new EZMoneyModel(); // TODO: 初始化為適當值
     RecordPresentationModel recordPModel = new RecordPresentationModel(ezMoneyModel); // TODO: 初始化為適當值
     RecordModel recordModel = ezMoneyModel.RecordModel;
     CategoryModel categoryModel = ezMoneyModel.CategoryModel;
     recordPModel.InitializeState();
     Category category = new Category(CATEGORY_NAME_WORK);
     categoryModel.AddCategory(category);
     DateTime date = DateTime.Now;
     recordModel.AddRecord(date, ref category, 100);
     recordModel.AddRecord(date, ref category, -100);
     recordPModel.SelectRecord(0);
     Assert.AreEqual(0, recordPModel.RecordIndex);
     recordPModel.SelectRecord(1);
     Assert.AreEqual(1, recordPModel.RecordIndex);
     recordPModel.SelectRecord(-1);
     Assert.IsFalse(recordPModel.IsSelectionMode);
 }