VerifyEmailAsync() public method

Checks to see if user has verified their email address. 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 VerifyEmailAsync ( ) : Task
return Task
コード例 #1
0
        public async Task VerifyEmailAsync_IsTrue()
        {
            var client = new ImgurClient(ClientId, ClientSecret, await GetOAuth2Token());
            var endpoint = new AccountEndpoint(client);

            var verified = await endpoint.VerifyEmailAsync();

            Assert.IsTrue(verified);
        }
コード例 #2
0
        public async Task VerifyEmailAsync_IsTrue()
        {
            var client = new MashapeClient(ClientId, ClientSecret, MashapeKey, OAuth2Token);
            var endpoint = new AccountEndpoint(client);

            var verified = await endpoint.VerifyEmailAsync();

            Assert.IsTrue(verified);
        }
コード例 #3
0
        public async Task VerifyEmailAsync_True()
        {
            var mockUrl = "https://api.imgur.com/3/account/me/verifyemail";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockAccountEndpointResponses.VerifyEmail)
            };

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

            Assert.True(updated);
        }
コード例 #4
0
        public async Task VerifyEmailAsync_ThrowsImgurException()
        {
            var mockUrl = "https://api.imgur.com/3/account/me/verifyemail";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.BadRequest)
            {
                Content = new StringContent(MockAccountEndpointResponses.VerifyEmailError)
            };

            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.VerifyEmailAsync().ConfigureAwait(false))
                        .ConfigureAwait(false);
            Assert.NotNull(exception);
            Assert.IsType<ImgurException>(exception);
        }
コード例 #5
0
        public async Task VerifyEmailAsync_OAuth2Null_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client);

            var exception =
                await
                    Record.ExceptionAsync(
                        async () => await endpoint.VerifyEmailAsync().ConfigureAwait(false))
                        .ConfigureAwait(false);
            Assert.NotNull(exception);
            Assert.IsType<ArgumentNullException>(exception);
        }