public async Task CreateReplyAsync_WithCommentNull_ThrowsArgumentNullException() { var fakeOAuth2Handler = new FakeOAuth2TokenHandler(); var client = new ImgurClient("123", "1234", fakeOAuth2Handler.GetOAuth2TokenCodeResponse()); var endpoint = new CommentEndpoint(client); await endpoint.CreateReplyAsync(null, "xyz", "Abc"); }
public async Task CreateReplyAsync_WithCommentIdNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234", MockOAuth2Token); var endpoint = new CommentEndpoint(client); var exception = await Record.ExceptionAsync( async() => await endpoint.CreateReplyAsync("Hello World!", "xyz", null).ConfigureAwait(false)) .ConfigureAwait(false); Assert.NotNull(exception); Assert.IsType <ArgumentNullException>(exception); }
public async Task CreateReplyAsync_Equal() { var mockUrl = "https://api.imgur.com/3/comment/BNMxDs"; var mockResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(MockCommentEndpointResponses.CreateReply) }; var client = new ImgurClient("123", "1234", MockOAuth2Token); var endpoint = new CommentEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse))); var comment = await endpoint.CreateReplyAsync("Hello World!", "xyz", "BNMxDs").ConfigureAwait(false); Assert.NotNull(comment); Assert.Equal(539717441, comment); }
public async Task CreateReplyAsync_AreEqual() { var fakeHttpMessageHandler = new FakeHttpMessageHandler(); var fakeResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(CommentEndpointResponses.CreateReplyResponse) }; fakeHttpMessageHandler.AddFakeResponse(new Uri("https://api.imgur.com/3/comment/BNMxDs"), fakeResponse); var fakeOAuth2Handler = new FakeOAuth2TokenHandler(); var client = new ImgurClient("123", "1234", fakeOAuth2Handler.GetOAuth2TokenCodeResponse()); var endpoint = new CommentEndpoint(client, new HttpClient(fakeHttpMessageHandler)); var comment = await endpoint.CreateReplyAsync("Hello World!", "xyz", "BNMxDs"); Assert.IsNotNull(comment); Assert.AreEqual(539717441, comment.Id); }
public async Task CreateReplyAsync_WithOAuth2TokenNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new CommentEndpoint(client); await endpoint.CreateReplyAsync("Hello World", "xyz", "Abc"); }