Exemplo n.º 1
0
        public async Task EnsuresNonNullArguments()
        {
            var connection = Substitute.For <IApiConnection>();
            var client     = new RepositoryInvitationsClient(connection);

            await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAllForCurrent(null));
        }
Exemplo n.º 2
0
        public async Task RequestsCorrectUrl()
        {
            var connection = Substitute.For <IApiConnection>();
            var client     = new RepositoryInvitationsClient(connection);

            await client.Delete(1, 2);

            connection.Connection.Received().Delete(Arg.Is <Uri>(u => u.ToString() == "repositories/1/invitations/2"), Arg.Any <object>(), "application/vnd.github.swamp-thing-preview+json");
        }
Exemplo n.º 3
0
        public async Task RequestsCorrectUrl()
        {
            var connection = Substitute.For <IApiConnection>();
            var client     = new RepositoryInvitationsClient(connection);

            await client.Accept(1);

            connection.Connection.Received().Patch(Arg.Is <Uri>(u => u.ToString() == "user/repository_invitations/1"), "application/vnd.github.swamp-thing-preview+json");
        }
Exemplo n.º 4
0
        public async Task RequestsCorrectUrl()
        {
            var connection = Substitute.For <IApiConnection>();
            var client     = new RepositoryInvitationsClient(connection);

            await client.GetAllForCurrent();

            connection.Received().GetAll <RepositoryInvitation>(Arg.Is <Uri>(u => u.ToString() == "user/repository_invitations"), null, "application/vnd.github.swamp-thing-preview+json", Args.ApiOptions);
        }
        public async Task RequestsCorrectUrl()
        {
            var connection = Substitute.For <IApiConnection>();
            var client     = new RepositoryInvitationsClient(connection);

            await client.Delete(1, 2);

            connection.Connection.Received().Delete(Arg.Is <Uri>(u => u.ToString() == "repositories/1/invitations/2"));
        }
        public async Task RequestsCorrectUrl()
        {
            var connection = Substitute.For <IApiConnection>();
            var client     = new RepositoryInvitationsClient(connection);

            await client.GetAllForRepository(1);

            connection.Received().GetAll <RepositoryInvitation>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/invitations"), Args.ApiOptions);
        }
Exemplo n.º 7
0
        public async Task RequestsCorrectUrl()
        {
            var connection        = Substitute.For <IApiConnection>();
            var client            = new RepositoryInvitationsClient(connection);
            var updatedInvitation = new InvitationUpdate(InvitationPermissionType.Read);

            await client.Edit(1, 2, updatedInvitation);

            connection.Received().Patch <RepositoryInvitation>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/invitations/2"), Arg.Is <InvitationUpdate>(updatedInvitation), "application/vnd.github.swamp-thing-preview+json");
        }
Exemplo n.º 8
0
        public async Task EnsureNonNullArguments()
        {
            var client = new RepositoryInvitationsClient(Substitute.For <IApiConnection>());

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