public async Task GetQuestionCategoryAsync_DoesntExist_ReturnNull() { var database = new TestDatabaseBuilder() .AddClassroom("Class1") .Build(); var questionCategoryService = new QuestionCategoryService(database.Context); var category = await questionCategoryService.GetQuestionCategoryAsync ( "Class1", id: 1 ); Assert.Null(category); }
public async Task GetQuestionCategoryAsync_Exists_ReturnCategory() { var database = new TestDatabaseBuilder() .AddClassroom("Class1") .AddQuestionCategory("Class1", "Category1") .Build(); var questionCategoryId = database.Context.QuestionCategories.First().Id; database.Reload(); var questionCategoryService = new QuestionCategoryService(database.Context); var category = await questionCategoryService.GetQuestionCategoryAsync ( "Class1", questionCategoryId ); Assert.Equal("Class1", category.Classroom.Name); Assert.Equal("Category1", category.Name); }