public async Task AddSlotsToTeamsAsyncShouldWorkCorrectly() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var dbContext = new ApplicationDbContext(options); var teamRepo = new EfDeletableEntityRepository <Team>(dbContext); var employeeRepo = new EfDeletableEntityRepository <ApplicationUser>(dbContext); var service = new TeamService(teamRepo, employeeRepo); await teamRepo.AddAsync(new Team()); await teamRepo.AddAsync(new Team { CityId = 10, }); await teamRepo.SaveChangesAsync(); await service.AddSlotsToTeamsAsync(); var teams = await teamRepo.All().ToListAsync(); Assert.Equal(2, teams.Count()); Assert.True(teams[0].InstalationSlots.Any()); Assert.True(teams[1].InstalationSlots.Any()); Assert.DoesNotContain(teams[0].InstalationSlots, x => x.StartingTime == DateTime.Parse("01/01/2021")); }