public void RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new RepoCollaboratorsClient(connection);

                var permission = new CollaboratorRequest(Permission.Push);

                client.Invite("owner", "test", "user1", permission);
                connection.Received().Put <RepositoryInvitation>(Arg.Is <Uri>(u => u.ToString() == "repos/owner/test/collaborators/user1"), Arg.Is <CollaboratorRequest>(permission), Arg.Any <string>(), Arg.Is <string>("application/vnd.github.swamp-thing-preview+json"));
            }
            public async Task EnsuresNonNullArguments()
            {
                var client     = new RepoCollaboratorsClient(Substitute.For <IApiConnection>());
                var permission = new CollaboratorRequest(Permission.Push);

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Invite(null, "test", "user1", permission));

                await Assert.ThrowsAsync <ArgumentException>(() => client.Invite("", "test", "user1", permission));

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Invite("owner", null, "user1", permission));

                await Assert.ThrowsAsync <ArgumentException>(() => client.Invite("owner", "", "user1", permission));

                await Assert.ThrowsAsync <ArgumentException>(() => client.Invite("owner", "test", "", permission));

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Invite("owner", "test", null, permission));

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Invite("owner", "test", "user1", null));
            }
            public async Task EnsuresNonNullArguments()
            {
                var client = new RepoCollaboratorsClient(Substitute.For<IApiConnection>());
                var permission = new CollaboratorRequest(Permission.Push);

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Invite(null, "test", "user1", permission));
                await Assert.ThrowsAsync<ArgumentException>(() => client.Invite("", "test", "user1", permission));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Invite("owner", null, "user1", permission));
                await Assert.ThrowsAsync<ArgumentException>(() => client.Invite("owner", "", "user1", permission));
                await Assert.ThrowsAsync<ArgumentException>(() => client.Invite("owner", "test", "", permission));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Invite("owner", "test", null, permission));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Invite("owner", "test", "user1", null));
            }
            public void RequestsCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new RepoCollaboratorsClient(connection);

                var permission = new CollaboratorRequest(Permission.Push);

                client.Invite("owner", "test", "user1", permission);
                connection.Received().Put<RepositoryInvitation>(Arg.Is<Uri>(u => u.ToString() == "repos/owner/test/collaborators/user1"), Arg.Is<CollaboratorRequest>(permission), Arg.Any<string>(), Arg.Is<string>("application/vnd.github.swamp-thing-preview+json"));
            }