/// <summary> /// Gets the album list. /// </summary> /// <param name="user">The user.</param> /// <returns>The list of albums.</returns> public PhotoAlbumCollection GetAlbumList(string user) { Dictionary <string, string> albums = this.googleData.GetAlbumList(user); PhotoAlbumCollection albumCollection = new PhotoAlbumCollection(); albumCollection.AddRange(albums.Select(x => { PhotoAlbum album = new PhotoAlbum { Id = x.Value.ToLower().Replace(' ', '_'), Title = x.Value }; Dictionary <string, Tuple <string, string> > photos = this.googleData.GetPhotoList(x.Key); album.Photos = photos.Select(y => new Photo { Title = y.Value.Item2, Url = y.Key, Thumbnail = y.Value.Item1 }).ToList(); return(album); }).ToArray()); return(albumCollection); }
public void PhotoAlbumCollectionTest() { // Arrange string[] testTitles = new string[] { "Test1", "Test2" }; PhotoAlbumCollection photoAlbumCollection = new PhotoAlbumCollection(); photoAlbumCollection.AddRange(testTitles.Select(x => new PhotoAlbum { Title = x })); // Act string actualResult = photoAlbumCollection.ToString(); string expectedResult = string.Join(", ", testTitles); // Assert Assert.AreEqual(expectedResult, actualResult); }
/// <summary> /// Gets the album list. /// </summary> /// <param name="user">The user.</param> /// <returns>The list of albums.</returns> public PhotoAlbumCollection GetAlbumList(string user) { Dictionary<string, string> albums = this.googleData.GetAlbumList(user); PhotoAlbumCollection albumCollection = new PhotoAlbumCollection(); albumCollection.AddRange(albums.Select(x => { PhotoAlbum album = new PhotoAlbum { Id = x.Value.ToLower().Replace(' ', '_'), Title = x.Value }; Dictionary<string, Tuple<string, string>> photos = this.googleData.GetPhotoList(x.Key); album.Photos = photos.Select(y => new Photo { Title = y.Value.Item2, Url = y.Key, Thumbnail = y.Value.Item1 }).ToList(); return album; }).ToArray()); return albumCollection; }