SendVerificationEmailAsync() public method

Sends an email to the user to verify that their email is valid to upload to gallery. OAuth authentication required.
/// Thrown when a null reference is passed to a method that does not accept it as a /// valid argument. /// Thrown when an error is found in a response from an Imgur endpoint. Thrown when an error is found in a response from a Mashape endpoint.
public SendVerificationEmailAsync ( ) : Task
return Task
コード例 #1
0
        public async Task SendVerificationEmailAsync_IsTrue()
        {
            var client = new MashapeClient(ClientId, ClientSecret, MashapeKey, OAuth2Token);
            var endpoint = new AccountEndpoint(client);

            await endpoint.SendVerificationEmailAsync();
        }
コード例 #2
0
        public async Task SendVerificationEmailAsync_ThrowsImgurException()
        {
            var mockUrl = "https://api.imgur.com/3/account/me/verifyemail";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.BadRequest)
            {
                Content = new StringContent(MockAccountEndpointResponses.SendVerificationEmailError)
            };

            var client = new ImgurClient("123", "1234", MockOAuth2Token);
            var endpoint = new AccountEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));

            var exception =
                await
                    Record.ExceptionAsync(
                        async () => await endpoint.SendVerificationEmailAsync().ConfigureAwait(false))
                        .ConfigureAwait(false);
            Assert.NotNull(exception);
            Assert.IsType<ImgurException>(exception);
        }
コード例 #3
0
        public async Task SendVerificationEmail_True()
        {
            var mockUrl = "https://api.imgur.com/3/account/me/verifyemail";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockAccountEndpointResponses.SendVerificationEmail)
            };

            var client = new ImgurClient("123", "1234", MockOAuth2Token);
            var endpoint = new AccountEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var updated = await endpoint.SendVerificationEmailAsync().ConfigureAwait(false);

            Assert.True(updated);
        }
コード例 #4
0
        public async Task SendVerificationEmail_OAuth2Null_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client);

            var exception = await Record.ExceptionAsync(
                async () => await endpoint.SendVerificationEmailAsync().ConfigureAwait(false))
                .ConfigureAwait(false);
            Assert.NotNull(exception);
            Assert.IsType<ArgumentNullException>(exception);
        }
コード例 #5
0
        public async Task SendVerificationEmailAsync_IsTrue()
        {
            var client = new ImgurClient(ClientId, ClientSecret, await GetOAuth2Token());
            var endpoint = new AccountEndpoint(client);

            var sent = await endpoint.SendVerificationEmailAsync();
        }