public void All_WithData_ReturnsSameData() { var options = new DbContextOptionsBuilder <GameInfoContext>() .UseInMemoryDatabase(databaseName: "Db_WithProfessions") .Options; using (var context = new GameInfoContext(options)) { var service = new ProfessionsService(context); var professions = new List <Profession> { new Profession() { Name = "1", }, new Profession() { Name = "2", }, new Profession() { Name = "3", } }; context.Professions.AddRange(professions); context.SaveChanges(); Assert.Equal(3, service.All().Count); } }
public void All_WithNoData_ReturnsNoData() { var options = new DbContextOptionsBuilder <GameInfoContext>() .UseInMemoryDatabase(databaseName: "NoProfessions_Db") .Options; using (var context = new GameInfoContext(options)) { var service = new ProfessionsService(context); Assert.Equal(0, service.All().Count); } }