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_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); }
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); }
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); }
public async Task SendVerificationEmailAsync_IsTrue() { var client = new ImgurClient(ClientId, ClientSecret, await GetOAuth2Token()); var endpoint = new AccountEndpoint(client); var sent = await endpoint.SendVerificationEmailAsync(); }