Beispiel #1
0
        public async Task TestUploadImageFromUrl()
        {
            var          imgurClient   = AuthenticationHelpers.CreateClientAuthenticatedImgurClient();
            const string imageUrl      = "http://www.ella-lapetiteanglaise.com/wp-content/uploads/2013/11/keep-calm-because-yolo-24.png";
            var          imageEndpoint = new ImageEndpoint(imgurClient);

            try
            {
                var response = await imageEndpoint.UploadImageFromUrlAsync(imageUrl, title : "yolo", description : "Keep Calm, because yolo #420");

                // Assert the Reponse
                Assert.IsNotNull(response.Data);
                Assert.AreEqual(response.Success, true);
                Assert.AreEqual(response.Status, HttpStatusCode.OK);
            }
            catch (ImgurResponseFailedException exception)
            {
                Assert.Fail(exception.ImgurResponse.Data.ErrorDescription);
            }
        }