public void All_WithData_ReturnsSameData() { var options = new DbContextOptionsBuilder <GameInfoContext>() .UseInMemoryDatabase(databaseName: "Db_WithGuides") .Options; using (var context = new GameInfoContext(options)) { var service = new GuidesService(context); var guides = new List <Guide> { new Guide() { Title = "1", Content = "1" }, new Guide() { Title = "2", Content = "2" }, new Guide() { Title = "3", Content = "3" } }; context.Guides.AddRange(guides); context.SaveChanges(); Assert.Equal(3, service.All().Count); } }
public void All_WithNoData_ReturnsNoData() { var options = new DbContextOptionsBuilder <GameInfoContext>() .UseInMemoryDatabase(databaseName: "NoGuides_Db") .Options; using (var context = new GameInfoContext(options)) { var service = new GuidesService(context); Assert.Equal(0, service.All().Count); } }