diff --git a/Octokit.Tests/Clients/IssueCommentsClientTests.cs b/Octokit.Tests/Clients/IssueCommentsClientTests.cs index 7584eeb9..64e29201 100644 --- a/Octokit.Tests/Clients/IssueCommentsClientTests.cs +++ b/Octokit.Tests/Clients/IssueCommentsClientTests.cs @@ -250,5 +250,51 @@ namespace Octokit.Tests.Clients Assert.Equal(issueResponseJson, response.HttpResponse.Body); Assert.Equal(1, response.Body.Id); } + + [Fact] + public void CanDeserializeIssueCommentWithReactions() + { + const string issueResponseJson = + "{\"id\": 1," + + "\"url\": \"https://api.github.com/repos/octocat/Hello-World/issues/comments/1\"," + + "\"html_url\": \"https://github.com/octocat/Hello-World/issues/1347#issuecomment-1\"," + + "\"body\": \"Me too\"," + + "\"user\": {" + + "\"login\": \"octocat\"," + + "\"id\": 1," + + "\"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\"," + + "\"gravatar_id\": \"somehexcode\"," + + "\"url\": \"https://api.github.com/users/octocat\"" + + "}," + + "\"created_at\": \"2011-04-14T16:00:49Z\"," + + "\"updated_at\": \"2011-04-14T16:00:49Z\"," + + "\"reactions\": {" + + "\"total_count\": 5," + + "\"+1\": 3," + + "\"-1\": 1," + + "\"laugh\": 0," + + "\"confused\": 0," + + "\"heart\": 1," + + "\"hooray\": 0," + + "\"url\": \"https://api.github.com/repos/octocat/Hello-World/issues/comments/1/reactions\"" + + "}" + + "}"; + var httpResponse = new Response( + HttpStatusCode.OK, + issueResponseJson, + new Dictionary(), + "application/json"); + + var jsonPipeline = new JsonHttpPipeline(); + + var response = jsonPipeline.DeserializeResponse(httpResponse); + + Assert.NotNull(response.Body); + Assert.Equal(issueResponseJson, response.HttpResponse.Body); + Assert.Equal(1, response.Body.Id); + Assert.NotNull(response.Body.Reactions); + Assert.Equal(5, response.Body.Reactions.TotalCount); + Assert.Equal(3, response.Body.Reactions.Plus1); + } } }