public async Task SendVerificationEmailAsync_IsTrue()
        {
            var client   = new MashapeClient(ClientId, ClientSecret, MashapeKey, OAuth2Token);
            var endpoint = new AccountEndpoint(client);

            await endpoint.SendVerificationEmailAsync();
        }
        public async Task SendVerificationEmailAsync_IsTrue()
        {
            var client   = new ImgurClient(ClientId, ClientSecret, await GetOAuth2Token());
            var endpoint = new AccountEndpoint(client);

            var sent = await endpoint.SendVerificationEmailAsync();
        }
Example #3
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);
        }
Example #4
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);
        }
Example #5
0
        public async Task SendVerificationEmail_IsTrue()
        {
            var fakeHttpMessageHandler = new FakeHttpMessageHandler();
            var fakeResponse           = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(AccountEndpointResponses.SendVerificationEmailResponse)
            };

            fakeHttpMessageHandler.AddFakeResponse(new Uri("https://api.imgur.com/3/account/me/verifyemail"),
                                                   fakeResponse);

            var fakeOAuth2Handler = new FakeOAuth2TokenHandler();
            var client            = new ImgurClient("123", "1234", fakeOAuth2Handler.GetOAuth2TokenCodeResponse());
            var endpoint          = new AccountEndpoint(client, new HttpClient(fakeHttpMessageHandler));
            var updated           = await endpoint.SendVerificationEmailAsync();

            Assert.IsTrue(updated);
        }
Example #6
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);
        }
Example #7
0
 public async Task SendVerificationEmail_OAuth2Null_ThrowsArgumentNullException()
 {
     var client   = new ImgurClient("123", "1234");
     var endpoint = new AccountEndpoint(client);
     await endpoint.SendVerificationEmailAsync();
 }