コード例 #1
0
ファイル: RecordModelTest.cs プロジェクト: housemeow/ezMoney
        public void TestGetNegativeRecords()
        {
            CategoryModel categoryModel = new CategoryModel();
            Category      categoryMovie = new Category(CATEGORY_NAME_MOVIE);
            Category      categoryWork  = new Category(CATEGORY_NAME_WORK);

            categoryModel.AddCategory(categoryMovie);
            categoryModel.AddCategory(categoryWork);
            RecordModel recordModel         = new RecordModel(categoryModel);
            DateTime    now                 = DateTime.Now;
            DateTime    date                = new DateTime(now.Year, now.Month, now.Day);
            Record      recordMoviePositive = new Record(date, categoryMovie, 100);
            Record      recordMovieNegative = new Record(date, categoryMovie, -100);
            Record      recordWorkPositive  = new Record(date, categoryWork, 100);
            Record      recordWorkNegative  = new Record(date, categoryWork, -100);

            recordModel.AddRecord(recordMoviePositive);
            recordModel.AddRecord(recordMovieNegative);
            recordModel.AddRecord(recordWorkPositive);
            recordModel.AddRecord(recordWorkNegative);
            BindingList <Record> negativeRecords = recordModel.GetNegativeRecords(recordModel.Records);

            Assert.AreEqual(2, negativeRecords.Count);
        }