Exemplo n.º 1
0
        public async Task TestUpdateImageDetails()
        {
            var filePath    = VariousFunctions.GetTestsAssetDirectory() + @"\upload-image-example.jpg";
            var imageBinary = File.ReadAllBytes(filePath);

            var imgurClient = await AuthenticationHelpers.CreateOAuth2AuthenticatedImgurClient();

            var imageEndpoint = new ImageEndpoint(imgurClient);

            var uploadedImage = await imageEndpoint.UploadImageFromBinaryAsync(imageBinary);

            var imageTitle          = String.Format("title-{0}", new Random().Next(0, 100));
            var imageDescription    = String.Format("description-{0}", new Random().Next(0, 100));
            var editedImageResponse = await imageEndpoint.UpdateImageDetailsAsync(uploadedImage.Data.Id, imageTitle, imageDescription);

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

            // Assert the Data
            Assert.AreEqual(editedImageResponse.Data, true);
        }