public void All_WithData_ReturnsSameData() { var options = new DbContextOptionsBuilder <GameInfoContext>() .UseInMemoryDatabase(databaseName: "Db_WithDungeons") .Options; using (var context = new GameInfoContext(options)) { var service = new DungeonsService(context, null); var dungeons = new List <Dungeon> { new Dungeon() { Name = "1" }, new Dungeon() { Name = "2" }, new Dungeon() { Name = "3" } }; context.Dungeons.AddRange(dungeons); context.SaveChanges(); Assert.Equal(3, service.All().Count); } }
public void All_WithNoData_ReturnsNoData() { var options = new DbContextOptionsBuilder <GameInfoContext>() .UseInMemoryDatabase(databaseName: "NoDungeons_Db") .Options; using (var context = new GameInfoContext(options)) { var service = new DungeonsService(context, null); Assert.Equal(0, service.All().Count); } }