Exemplo n.º 1
0
        public void CanHandleInternalServerErrorHttpStatusSendFriendRequestResponse()
        {
            MockHttpMessageHandler.SetResponse(string.Empty, HttpStatusCode.InternalServerError);
            var api    = new FriendsApi();
            var result = api.SendRequest("some user id", "my username").Result;

            result.Should().BeNull();
        }
Exemplo n.º 2
0
        public void CanHandleSendFriendRequestResponse()
        {
            MockHttpMessageHandler.SetResponse(new JObject(
                                                   new JProperty("id", "some id"),
                                                   new JProperty("type", "friendrequest"),
                                                   new JProperty("senderUserId", "some sender user id"),
                                                   new JProperty("receiverUserId", "some receiver user id"),
                                                   new JProperty("message", "some message"),
                                                   new JProperty("details", new JObject()),
                                                   new JProperty("jobName", "some job name"),
                                                   new JProperty("jobColor", "some job color")));

            var api    = new FriendsApi();
            var result = api.SendRequest("some user id", "my username").Result;

            result.id.Should().Be("some id");
            result.type.Should().Be("friendrequest");
            result.senderUserId.Should().Be("some sender user id");
            result.receiverUserId.Should().Be("some receiver user id");
            result.message.Should().Be("some message");
            result.details.Should().BeEmpty();
            result.jobName.Should().Be("some job name");
            result.jobColor.Should().Be("some job color");
        }