public void GetKeywordsShouldNotThrowExceptionIfDBIsEmpty() { //Arrange var options = new DbContextOptionsBuilder <Project2DBContext>() .UseInMemoryDatabase(databaseName: "EmptyKeywordDB1") .Options; bool result = true; KeywordRepo kRepo; //Act using (var context = new Project2DBContext(options)) { kRepo = new KeywordRepo(context); try { kRepo.GetKeywords(); } catch { result = false; } } //Assert Assert.True(result); }
public void GetKeywordsShouldReturnAListWithProperNumberOfKeywords() { //Arrange var options = new DbContextOptionsBuilder <Project2DBContext>() .UseInMemoryDatabase(databaseName: "StaticFilledKeywordDB") .Options; KeywordRepo kRepo; List <Keyword> kList; //Act using (var context = new Project2DBContext(options)) { kRepo = new KeywordRepo(context); kList = kRepo.GetKeywords().ToList(); } //Assert Assert.Equal(3, kList.Count); }