public void TestFaqFilledRepository() { var optionsBuilder = new DbContextOptionsBuilder <HomeMyDayDbContext>(); optionsBuilder.UseInMemoryDatabase(Guid.NewGuid().ToString()); HomeMyDayDbContext context = new HomeMyDayDbContext(optionsBuilder.Options); context.FaqCategory.AddRange( new FaqCategory() { CategoryName = "TestA" }, new FaqCategory() { CategoryName = "TestB" }, new FaqCategory() { CategoryName = "TestC" } ); context.SaveChanges(); IFaqRepository repository = new EFFaqRepository(context); Assert.True(repository.GetCategoriesAndQuestions().Count() == 3); }
public void TestFaqEmptyRepository() { var optionsBuilder = new DbContextOptionsBuilder <HomeMyDayDbContext>(); optionsBuilder.UseInMemoryDatabase(Guid.NewGuid().ToString()); HomeMyDayDbContext context = new HomeMyDayDbContext(optionsBuilder.Options); IFaqRepository repository = new EFFaqRepository(context); Assert.Empty(repository.GetCategoriesAndQuestions()); }