public void PhotosInAlbums_NoPhotosInAlbums_ReturnsEmptyList() { var albums = new List <Album> { new Album { Id = 1 }, new Album { Id = 2 }, new Album { Id = 3 }, }; var photos = new List <PhotoDto> { new PhotoDto { Id = 1, AlbumId = 4 }, new PhotoDto { Id = 2, AlbumId = 5 }, new PhotoDto { Id = 3, AlbumId = 6 }, }; var queryExpression = _factory.PhotosInAlbums(albums); List <PhotoDto> result = photos.AsQueryable().Where(queryExpression).ToList(); Assert.AreEqual(0, result.Count()); }
public IEnumerable <PhotoAlbum> GetByUserId(int userId) { Expression <Func <AlbumDto, bool> > query = album => album.UserId == userId; var userAlbums = _albumRepository.GetAll(_expressionFactory.AlbumsByUserId(userId)).ToList().Select(Map); var photosInUserAlbums = _photoRepository.GetAll(_expressionFactory.PhotosInAlbums(userAlbums)).ToList().Select(Map); return(MergePhotosWithAlbums(photosInUserAlbums, userAlbums)); }