public void TestGetRecordsByCategory() { 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(recordMovieNegative); recordModel.AddRecord(recordWorkPositive); recordModel.AddRecord(recordWorkPositive); recordModel.AddRecord(recordWorkPositive); recordModel.AddRecord(recordWorkNegative); recordModel.AddRecord(recordWorkNegative); recordModel.AddRecord(recordWorkNegative); recordModel.AddRecord(recordWorkNegative); BindingList <Record> movieRecords; movieRecords = recordModel.GetRecords(categoryMovie); Assert.AreEqual(3, movieRecords.Count); BindingList <Record> workRecords; workRecords = recordModel.GetRecords(categoryWork); Assert.AreEqual(7, workRecords.Count); }
public void TestGetRecordsWithCategoryAndPositive() { 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(recordMovieNegative); recordModel.AddRecord(recordWorkPositive); recordModel.AddRecord(recordWorkPositive); recordModel.AddRecord(recordWorkPositive); recordModel.AddRecord(recordWorkNegative); recordModel.AddRecord(recordWorkNegative); recordModel.AddRecord(recordWorkNegative); recordModel.AddRecord(recordWorkNegative); BindingList <Record> positiveMovieRecords; positiveMovieRecords = recordModel.GetRecords(categoryMovie, true); Assert.AreEqual(1, positiveMovieRecords.Count); BindingList <Record> negativeMovieRecords; negativeMovieRecords = recordModel.GetRecords(categoryMovie, false); Assert.AreEqual(2, negativeMovieRecords.Count); BindingList <Record> positiveWorkRecords; positiveWorkRecords = recordModel.GetRecords(categoryWork, true); Assert.AreEqual(3, positiveWorkRecords.Count); BindingList <Record> negativeWorkRecords; negativeWorkRecords = recordModel.GetRecords(categoryWork, false); Assert.AreEqual(4, negativeWorkRecords.Count); }