public async Task TakeAllPictures_ShouldReturnAllPicturesFromUser() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var repository = new EfDeletableEntityRepository <ApplicationUser>(new ApplicationDbContext(options)); var imageRepository = new EfDeletableEntityRepository <UserImage>(new ApplicationDbContext(options)); var service = new ModelService.ModelService(repository, null, imageRepository, null); var user1 = await this.CreateUserWithImage("*****@*****.**", "Pesho", "Peshev", repository); var takeImages = await service.TakeAllPictures <AlbumViewModel>(user1); var count = 0; foreach (var image in takeImages) { count = image.UserImages.Count(); } Assert.Equal(3, count); }