public void CanHandleValidFriendsOfCurrentUserResponse() { MockHttpMessageHandler.SetResponse(new JArray( new JObject( new JProperty("id", "some id"), new JProperty("username", "some username"), new JProperty("displayName", "some display name"), new JProperty("currentAvatarImageUrl", "https://some.url/currentAvatarImageUrl.jpg"), new JProperty("currentAvatarThumbnailImageUrl", "https://some.url/currentAvatarThumbnailImageUrl.jpg"), new JProperty("tags", new JArray("tag 1", "tag 2")), new JProperty("developerType", "some developer type"), new JProperty("location", "some location")))); var api = new FriendsApi(); var result = api.Get(0, 20, false).Result; result.Should().HaveCount(1); result[0].id.Should().Be("some id"); result[0].username.Should().Be("some username"); result[0].displayName.Should().Be("some display name"); result[0].currentAvatarImageUrl.Should().Be("https://some.url/currentAvatarImageUrl.jpg"); result[0].currentAvatarThumbnailImageUrl.Should().Be("https://some.url/currentAvatarThumbnailImageUrl.jpg"); result[0].tags.Should().HaveCount(2).And.ContainInOrder("tag 1", "tag 2"); result[0].developerType.Should().Be("some developer type"); result[0].location.Should().Be("some location"); }
public void CanHandleInternalServerErrorHttpStatusFriendsOfCurrentUserResponse() { MockHttpMessageHandler.SetResponse(string.Empty, HttpStatusCode.InternalServerError); var api = new FriendsApi(); var result = api.Get().Result; result.Should().BeNull(); }