Ejemplo n.º 1
0
        public async Task TestRemoveImagesFromAlbum()
        {
            var imgurClient = await AuthenticationHelpers.CreateOAuth2AuthenticatedImgurClient();

            var albumEndpoint = new AlbumEndpoint(imgurClient);
            var imageEndpoint = new ImageEndpoint(imgurClient);

            var filePath     = VariousFunctions.GetTestsAssetDirectory() + @"\upload-image-example.jpg";
            var imageBinary  = File.ReadAllBytes(filePath);
            var createdAlbum = await albumEndpoint.CreateAlbumAsync(new[] { (await imageEndpoint.UploadImageFromBinaryAsync(imageBinary)).Data });

            await albumEndpoint.RemoveImageFromAlbumAsync(createdAlbum.Data.Id, createdAlbum.Data.Images[0].Id);

            var updatedAlbum = await albumEndpoint.GetAlbumDetailsAsync(createdAlbum.Data.Id);

            // Assert the Reponse
            Assert.IsNotNull(updatedAlbum.Data);
            Assert.AreEqual(updatedAlbum.Success, true);
            Assert.AreEqual(updatedAlbum.Status, HttpStatusCode.OK);
        }