コード例 #1
0
            public async Task EnsuresNonNullArguments()
            {
                var client = new RepositoriesClient(Substitute.For<IApiConnection>());

                await AssertEx.Throws<ArgumentNullException>(async () => await client.Delete(null, "aRepoName"));
                await AssertEx.Throws<ArgumentNullException>(async () => await client.Delete("anOwner", null));
            }
コード例 #2
0
            public async Task EnsuresNonNullArguments()
            {
                var client = new RepositoriesClient(Substitute.For <IApiConnection>());

                await Assert.ThrowsAsync <ArgumentNullException>(() => client.Delete(null, "name"));

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

                await Assert.ThrowsAsync <ArgumentException>(() => client.Delete("", "name"));

                await Assert.ThrowsAsync <ArgumentException>(() => client.Delete("owner", ""));
            }
コード例 #3
0
 public async Task DeleteRepository(long repositoryId, GitHubClient authorizedGitHubClient)
 {
     if (_repositoriesClient == null)
     {
         _repositoriesClient = new RepositoriesClient(new ApiConnection(authorizedGitHubClient.Connection));
     }
     await _repositoriesClient.Delete(repositoryId);
 }
コード例 #4
0
            public async Task RequestsCorrectUrl()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new RepositoriesClient(connection);

                await client.Delete("theOwner", "theRepoName");

                connection.Received().Delete(Arg.Is <Uri>(u => u.ToString() == "repos/theOwner/theRepoName"));
            }
コード例 #5
0
            public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For <IApiConnection>();
                var client     = new RepositoriesClient(connection);

                await client.Delete(1);

                connection.Received().Delete(Arg.Is <Uri>(u => u.ToString() == "repositories/1"));
            }
コード例 #6
0
            public async Task RequestsCorrectUrl()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new RepositoriesClient(connection);

                await client.Delete("theOwner", "theRepoName");

                connection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "repos/theOwner/theRepoName"));
            }
コード例 #7
0
            public async Task EnsuresNonNullArguments()
            {
                var client = new RepositoriesClient(Substitute.For<IApiConnection>());

                await AssertEx.Throws<ArgumentNullException>(async () => await client.Delete(null, "aRepoName"));
                await AssertEx.Throws<ArgumentNullException>(async () => await client.Delete("anOwner", null));
            }
コード例 #8
0
            public async Task EnsuresNonNullArguments()
            {
                var client = new RepositoriesClient(Substitute.For<IApiConnection>());

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Delete(null, "name"));
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.Delete("owner", null));

                await Assert.ThrowsAsync<ArgumentException>(() => client.Delete("", "name"));
                await Assert.ThrowsAsync<ArgumentException>(() => client.Delete("owner", ""));
            }
コード例 #9
0
            public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var connection = Substitute.For<IApiConnection>();
                var client = new RepositoriesClient(connection);

                await client.Delete(1);

                connection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "repositories/1"));
            }