public async Task RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new PersonFieldsClient(connection);

                await client.Get(123);

                Received.InOrder(async() =>
                {
                    await connection.Get <PersonField>(Arg.Is <Uri>(u => u.ToString() == "personFields/123"));
                });
            }
            public void PostsToTheCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new PersonFieldsClient(connection);

                var newPersonField = new NewPersonField("name", FieldType.org);

                client.Create(newPersonField);

                connection.Received().Post <PersonField>(Arg.Is <Uri>(u => u.ToString() == "personFields"),
                                                         Arg.Is <NewPersonField>(df => df.Name == "name" &&
                                                                                 df.FieldType == FieldType.org));
            }
            public void PutsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new PersonFieldsClient(connection);

                var editPersonField = new PersonFieldUpdate {
                    Name = "name", Options = "{}"
                };

                client.Edit(123, editPersonField);

                connection.Received().Put <PersonField>(Arg.Is <Uri>(u => u.ToString() == "personFields/123"),
                                                        Arg.Is <PersonFieldUpdate>(df => df.Name == "name" &&
                                                                                   (string)df.Options == "{}"));
            }
            public async Task EnsuresNonNullArguments()
            {
                var client = new PersonFieldsClient(Substitute.For <IApiConnection>());

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Edit(1, null));
            }