public async Task GetCommentAsync_IsNotNull() { var fakeHttpMessageHandler = new FakeHttpMessageHandler(); var fakeResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(AccountEndpointResponses.GetCommentResponse) }; fakeHttpMessageHandler.AddFakeResponse(new Uri("https://api.imgur.com/3/account/sarah/comment/yMgB7"), fakeResponse); var client = new ImgurClient("123", "1234"); var endpoint = new AccountEndpoint(client, new HttpClient(fakeHttpMessageHandler)); var comment = await endpoint.GetCommentAsync("yMgB7", "sarah"); Assert.IsNotNull(comment); Assert.AreEqual(487008510, comment.Id); Assert.AreEqual("DMcOm2V", comment.ImageId); Assert.AreEqual( "Gyroscope detectors measure inertia.. the stabilization is done entirely by brushless motors. There are stabilizers which actually use 1/2", comment.CommentText); Assert.AreEqual("Scabab", comment.Author); Assert.AreEqual(4194299, comment.AuthorId); Assert.AreEqual(false, comment.OnAlbum); Assert.AreEqual(null, comment.AlbumCover); Assert.AreEqual(24, comment.Ups); Assert.AreEqual(0, comment.Downs); Assert.AreEqual(24, comment.Points); Assert.AreEqual(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(1443969120), comment.DateTime); Assert.AreEqual(486983435, comment.ParentId); Assert.AreEqual(false, comment.Deleted); Assert.AreEqual(Vote.Down, comment.Vote); Assert.AreEqual(comment.Platform, "desktop"); }
public async Task GetCommentAsync_WithValidReponse_AreEqual() { var client = new MashapeClient(ClientId, ClientSecret, MashapeKey); var endpoint = new AccountEndpoint(client); var comment = await endpoint.GetCommentAsync("300731088", "sarah"); Assert.IsNotNull(comment); }
public async Task GetCommentAsync_AreEqual() { var client = new ImgurClient(ClientId, ClientSecret); var endpoint = new AccountEndpoint(client); var comment = await endpoint.GetCommentAsync("300731088", "sarah"); Assert.IsNotNull(comment); }
public async Task GetCommentAsync_WithUsernameNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new AccountEndpoint(client); var exception = await Record.ExceptionAsync( async() => await endpoint.GetCommentAsync(68767677, null).ConfigureAwait(false)) .ConfigureAwait(false); Assert.NotNull(exception); Assert.IsType <ArgumentNullException>(exception); }
public async Task GetCommentAsync_WithUsernameNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new AccountEndpoint(client); await endpoint.GetCommentAsync("yMgB7", null); }