public void TestStatistic() { CategoryModel categoryModel = new CategoryModel(); // TODO: 初始化為適當值 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); // TODO: 初始化為適當值 DateTime now = DateTime.Now; DateTime date = new DateTime(now.Year, now.Month, now.Day); Record workRecord = new Record(date, categoryWork, 1000); recordModel.AddRecord(workRecord); workRecord = new Record(date, categoryWork, 2000); recordModel.AddRecord(workRecord); workRecord = new Record(date, categoryWork, 3000); recordModel.AddRecord(workRecord); workRecord = new Record(date, categoryWork, 4000); recordModel.AddRecord(workRecord); StatisticModel statisticModel = new StatisticModel(categoryModel, recordModel); // TODO: 初始化為適當值 Statistic statistic = statisticModel.GetStatistic(categoryWork, true); Assert.AreEqual(10000, statistic.Amounts); Assert.AreEqual(categoryWork, statistic.Category); Assert.AreEqual(4, statistic.Count); }