mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-08 20:45:51 +00:00
Add test to ensure we can deserialize an issue comment with the reactions object
This commit is contained in:
@@ -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<string, string>(),
|
||||
"application/json");
|
||||
|
||||
var jsonPipeline = new JsonHttpPipeline();
|
||||
|
||||
var response = jsonPipeline.DeserializeResponse<IssueComment>(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user