public void AlbumInstantiation() { var options = new AlbumOptions(); SetAlbumOptions(options); var album = new Album("-1", "-1", options); AssertAlbum(album, options); AssertAlbum(album, album.GetOptions()); }
static void SetAlbumOptions(AlbumOptions options) { SetContainerOptions(options); options.StorageMedium = "7"; options.LongDescription = "8"; options.Description = "9"; options.Date = "10"; options.Publishers = new[] { "publisher" }; options.Contributors = new[] { "contributor" }; options.Relations = new[] { new Uri("http://relation") }; options.Rights = new[] { "right" }; }
private static async Task <int> HandleAlbumOptions(AlbumOptions options) { var handler = await DefaultOptionsHandler.CreateAsync(options).ConfigureAwait(false); var client = handler.GetCurrentMuzlanClient(); var authResponse = await client.Auth.Authenticate().ConfigureAwait(false); if (!authResponse.HasResult) { return(ExitCodeHelper.Set(ExitCode.AuthenticationFailure)); } if (!string.IsNullOrEmpty(options.Url)) { // TODO: parse album or artist url return(ExitCodeHelper.Set(ExitCode.ParserError)); } else if (string.IsNullOrEmpty(options.Album)) { var artistResponse = await RateLimitHelper.BypassRateLimitAsync( handler, (client) => client.Albums.FindAlbums(options.Artist ?? string.Empty)).ConfigureAwait(false); if (artistResponse.HasResult) { var json = await JsonHelper.SerializeAsync(artistResponse.Result, handler.PrettyPrint).ConfigureAwait(false); Console.WriteLine(json); } return(ExitCodeHelper.Set(artistResponse)); } else { var albumResponse = await RateLimitHelper.BypassRateLimitAsync( handler, (client) => client.Albums.GetTracks(options.Artist ?? string.Empty, options.Album ?? string.Empty)) .ConfigureAwait(false); if (albumResponse.HasResult) { var json = await JsonHelper.SerializeAsync(albumResponse.Result, handler.PrettyPrint).ConfigureAwait(false); Console.WriteLine(json); } return(ExitCodeHelper.Set(albumResponse)); } }
static void AssertAlbum(Album album, AlbumOptions options) { AssertContainer(album, options); Assert.AreEqual(album.StorageMedium, options.StorageMedium); Assert.AreEqual(album.LongDescription, options.LongDescription); Assert.AreEqual(album.Description, options.Description); Assert.AreEqual(album.Date, options.Date); Assert.IsTrue(album.Publishers.IsReadOnly); Assert.IsTrue(album.Contributors.IsReadOnly); Assert.IsTrue(album.Relations.IsReadOnly); Assert.IsTrue(album.Rights.IsReadOnly); CollectionAssert.AreEqual(album.Publishers, options.Publishers); CollectionAssert.AreEqual(album.Contributors, options.Contributors); CollectionAssert.AreEqual(album.Relations, options.Relations); CollectionAssert.AreEqual(album.Rights, options.Rights); }
Container GetContainer(Tag tag, Container parent) { Container container = null; if (!tags_cache.ContainsKey(tag.Id)) { var album_options = new AlbumOptions { Title = tag.Name, Description = "Tag" }; var photo_album = new PhotoAlbum((id++).ToString(), parent.Id, album_options); tags_cache.Add(tag.Id, photo_album); container = photo_album; } else { container = tags_cache [tag.Id]; } return(container); }
public PhotoAlbum (string id, string parentId, AlbumOptions options) : base (id, parentId, options) { }
public PhotoAlbum(string id, string parentId, AlbumOptions options) : base(id, parentId, options) { }