public async Task UpdateComment_ValidResponse_ValidComment()
{
/*** Arrange ***/
string responseString = "{\"type\":\"comment\",\"id\":\"191969\",\"is_reply_comment\":false,\"message\":\"These tigers are cool!\",\"created_by\":{\"type\":\"user\",\"id\":\"17738362\",\"name\":\"sean rose\",\"login\":\"[email protected]\"},\"created_at\":\"2012-12-12T11:25:01-08:00\",\"item\":{\"id\":\"5000948880\",\"type\":\"file\"},\"modified_at\":\"2012-12-12T11:25:01-08:00\"}";
IBoxRequest boxRequest = null;
_handler.Setup(h => h.ExecuteAsync<BoxComment>(It.IsAny<IBoxRequest>()))
.Returns(Task.FromResult<IBoxResponse<BoxComment>>(new BoxResponse<BoxComment>()
{
Status = ResponseStatus.Success,
ContentString = responseString
})).Callback<IBoxRequest>(r => boxRequest = r);
/*** Act ***/
BoxCommentRequest request = new BoxCommentRequest()
{
Message = "fakeMessage"
};
BoxComment c = await _commentsManager.UpdateAsync("fakeId", request);
/*** Assert ***/
/*** Request ***/
BoxCommentRequest payLoad = JsonConvert.DeserializeObject<BoxCommentRequest>(boxRequest.Payload);
Assert.AreEqual(request.Message, payLoad.Message);
/** Response ***/
Assert.AreEqual("comment", c.Type);
Assert.AreEqual("191969", c.Id);
Assert.AreEqual("These tigers are cool!", c.Message);
}