コード例 #1
0
        public async Task AlbumManagementShouldWorkCorrectlyForUserId()
        {
            // create a new album...
            const string originalName = "Unit Test Album";
            const string originalDesc =
                "This album was created via an automated test, and should be deleted momentarily...";

            var newAlbum = await AuthenticatedClient.CreateAlbumAsync(VimeoSettings.PublicUserId, new EditAlbumParameters
            {
                Name        = originalName,
                Description = originalDesc,
                Sort        = EditAlbumSortOption.Newest,
                Privacy     = EditAlbumPrivacyOption.Password,
                Password    = "******"
            });

            newAlbum.ShouldNotBeNull();
            newAlbum.Name.ShouldBe(originalName);

            newAlbum.Description.ShouldBe(originalDesc);

            // retrieve albums for the current user...there should be at least one now...
            var albums = await AuthenticatedClient.GetAlbumsAsync(UserId.Me);

            albums.Total.ShouldBeGreaterThan(0);

            // update the album...
            const string updatedName = "Unit Test Album (Updated)";
            var          albumId     = newAlbum.GetAlbumId();

            albumId.ShouldNotBeNull();
            var updatedAlbum = await AuthenticatedClient.UpdateAlbumAsync(UserId.Me, albumId.Value,
                                                                          new EditAlbumParameters
            {
                Name    = updatedName,
                Privacy = EditAlbumPrivacyOption.Anybody
            });

            updatedAlbum.Name.ShouldBe(updatedName);

            // delete the album...
            albumId = updatedAlbum.GetAlbumId();
            albumId.ShouldNotBeNull();
            var isDeleted = await AuthenticatedClient.DeleteAlbumAsync(UserId.Me, albumId.Value);

            isDeleted.ShouldBeTrue();
        }