public async Task AddEmployeeAsyncShouldWorkCorrectly() { 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); var employeeId = Guid.NewGuid().ToString(); var teamId = 1; await teamRepo.AddAsync(new Team()); await teamRepo.SaveChangesAsync(); await employeeRepo.AddAsync(new ApplicationUser { Id = employeeId, }); await employeeRepo.SaveChangesAsync(); await service.AddEmployeeAsync(teamId, employeeId); var team = await teamRepo.All() .FirstOrDefaultAsync(); var employee = await employeeRepo.All() .FirstOrDefaultAsync(); Assert.Contains(team.Employees, x => x.Id == employeeId); Assert.Equal(teamId, team.Id); }