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)); }
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", "")); }
public async Task DeleteRepository(long repositoryId, GitHubClient authorizedGitHubClient) { if (_repositoriesClient == null) { _repositoriesClient = new RepositoriesClient(new ApiConnection(authorizedGitHubClient.Connection)); } await _repositoriesClient.Delete(repositoryId); }
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")); }
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")); }
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")); }
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", "")); }
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")); }