mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-22 23:25:24 +00:00
Remove obsolete members (#1622)
* remove obsolete "Branches" methods from RepositoryClient (all were previuosly moved to RepositoryBranchesClient) * Remove obsolete DeploymentStatus fields * Remove obsoleteMergePullRequest.Squash parameter * Remove obsolete request ctor * Remove tests * Not sure how I missed these test references
This commit is contained in:
@@ -221,58 +221,6 @@ namespace Octokit.Reactive
|
||||
///</remarks>
|
||||
IObservableMergingClient Merging { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the branches for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/repos/#list-branches">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
/// <returns>All <see cref="T:Octokit.Branch"/>es of the repository</returns>
|
||||
[Obsolete("Please use ObservableRepositoriesClient.Branch.GetAll() instead. This method will be removed in a future version")]
|
||||
IObservable<Branch> GetAllBranches(string owner, string name);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the branches for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/repos/#list-branches">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
/// <returns>All <see cref="T:Octokit.Branch"/>es of the repository</returns>
|
||||
[Obsolete("Please use ObservableRepositoriesClient.Branch.GetAll() instead. This method will be removed in a future version")]
|
||||
IObservable<Branch> GetAllBranches(long repositoryId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the branches for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/repos/#list-branches">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
/// <returns>All <see cref="T:Octokit.Branch"/>es of the repository</returns>
|
||||
[Obsolete("Please use ObservableRepositoriesClient.Branch.GetAll() instead. This method will be removed in a future version")]
|
||||
IObservable<Branch> GetAllBranches(string owner, string name, ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the branches for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/repos/#list-branches">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
/// <returns>All <see cref="T:Octokit.Branch"/>es of the repository</returns>
|
||||
[Obsolete("Please use ObservableRepositoriesClient.Branch.GetAll() instead. This method will be removed in a future version")]
|
||||
IObservable<Branch> GetAllBranches(long repositoryId, ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all contributors for the specified repository. Does not include anonymous contributors.
|
||||
/// </summary>
|
||||
@@ -474,31 +422,6 @@ namespace Octokit.Reactive
|
||||
/// <returns>All of the repositories tags.</returns>
|
||||
IObservable<RepositoryTag> GetAllTags(long repositoryId, ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the specified branch.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/repos/#get-branch">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="branchName">The name of the branch</param>
|
||||
/// <returns>The specified <see cref="T:Octokit.Branch"/></returns>
|
||||
[Obsolete("Please use ObservableRepositoriesClient.Branch.Get() instead. This method will be removed in a future version")]
|
||||
IObservable<Branch> GetBranch(string owner, string name, string branchName);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the specified branch.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/repos/#get-branch">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="branchName">The name of the branch</param>
|
||||
/// <returns>The specified <see cref="T:Octokit.Branch"/></returns>
|
||||
[Obsolete("Please use ObservableRepositoriesClient.Branch.Get() instead. This method will be removed in a future version")]
|
||||
IObservable<Branch> GetBranch(long repositoryId, string branchName);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the specified repository with the values given in <paramref name="update"/>
|
||||
/// </summary>
|
||||
|
||||
@@ -322,79 +322,6 @@ namespace Octokit.Reactive
|
||||
///</remarks>
|
||||
public IObservableMergingClient Merging { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the branches for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/branches/#list-branches">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
/// <returns>All <see cref="T:Octokit.Branch"/>es of the repository</returns>
|
||||
[Obsolete("Please use ObservableRepositoriesClient.Branch.GetAll() instead. This method will be removed in a future version")]
|
||||
public IObservable<Branch> GetAllBranches(string owner, string name)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return Branch.GetAll(owner, name, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the branches for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/branches/#list-branches">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
/// <returns>All <see cref="T:Octokit.Branch"/>es of the repository</returns>
|
||||
[Obsolete("Please use ObservableRepositoriesClient.Branch.GetAll() instead. This method will be removed in a future version")]
|
||||
public IObservable<Branch> GetAllBranches(long repositoryId)
|
||||
{
|
||||
return Branch.GetAll(repositoryId, ApiOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the branches for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/branches/#list-branches">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
/// <returns>All <see cref="T:Octokit.Branch"/>es of the repository</returns>
|
||||
[Obsolete("Please use ObservableRepositoriesClient.Branch.GetAll() instead. This method will be removed in a future version")]
|
||||
public IObservable<Branch> GetAllBranches(string owner, string name, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return Branch.GetAll(owner, name, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the branches for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/branches/#list-branches">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
/// <returns>All <see cref="T:Octokit.Branch"/>es of the repository</returns>
|
||||
[Obsolete("Please use ObservableRepositoriesClient.Branch.GetAll() instead. This method will be removed in a future version")]
|
||||
public IObservable<Branch> GetAllBranches(long repositoryId, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return Branch.GetAll(repositoryId, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all contributors for the specified repository. Does not include anonymous contributors.
|
||||
/// </summary>
|
||||
@@ -705,43 +632,6 @@ namespace Octokit.Reactive
|
||||
return _connection.GetAndFlattenAllPages<RepositoryTag>(ApiUrls.RepositoryTags(repositoryId), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the specified branch.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/branches/#get-branch">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="branchName">The name of the branch</param>
|
||||
/// <returns>The specified <see cref="T:Octokit.Branch"/></returns>
|
||||
[Obsolete("Please use ObservableRepositoriesClient.Branch.Get() instead. This method will be removed in a future version")]
|
||||
public IObservable<Branch> GetBranch(string owner, string name, string branchName)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNullOrEmptyString(branchName, "branchName");
|
||||
|
||||
return Branch.Get(owner, name, branchName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the specified branch.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/branches/#get-branch">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="branchName">The name of the branch</param>
|
||||
/// <returns>The specified <see cref="T:Octokit.Branch"/></returns>
|
||||
[Obsolete("Please use ObservableRepositoriesClient.Branch.Get() instead. This method will be removed in a future version")]
|
||||
public IObservable<Branch> GetBranch(long repositoryId, string branchName)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(branchName, "branchName");
|
||||
|
||||
return Branch.Get(repositoryId, branchName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the specified repository with the values given in <paramref name="update"/>
|
||||
/// </summary>
|
||||
|
||||
@@ -668,22 +668,6 @@ public class PullRequestsClientTests : IDisposable
|
||||
Assert.True(result.Merged);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanBeMergedWithSquashCommit()
|
||||
{
|
||||
await CreateTheWorld();
|
||||
|
||||
var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "master");
|
||||
var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
|
||||
|
||||
var merge = new MergePullRequest { CommitMessage = "fake commit message", CommitTitle = "fake title", Squash = true };
|
||||
var result = await _fixture.Merge(Helper.UserName, _context.RepositoryName, pullRequest.Number, merge);
|
||||
var commit = await _github.Repository.Commit.Get(_context.RepositoryOwner, _context.RepositoryName, result.Sha);
|
||||
|
||||
Assert.True(result.Merged);
|
||||
Assert.Equal("fake title\n\nfake commit message", commit.Commit.Message);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanBeMergedWithMergeMethod()
|
||||
{
|
||||
|
||||
@@ -1458,186 +1458,6 @@ public class RepositoriesClientTests
|
||||
}
|
||||
}
|
||||
|
||||
public class TheGetAllBranchesMethod
|
||||
{
|
||||
[IntegrationTest]
|
||||
public async Task GetsAllBranches()
|
||||
{
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
|
||||
var branches = await github.Repository.GetAllBranches("octokit", "octokit.net");
|
||||
|
||||
Assert.NotEmpty(branches);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task GetsAllBranchesWithRepositoryId()
|
||||
{
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
|
||||
var branches = await github.Repository.GetAllBranches(7528679);
|
||||
|
||||
Assert.NotEmpty(branches);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsCorrectCountOfBranchesWithoutStart()
|
||||
{
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var branches = await github.Repository.GetAllBranches("octokit", "octokit.net", options);
|
||||
|
||||
Assert.Equal(5, branches.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsCorrectCountOfBranchesWithoutStartWithRepositoryId()
|
||||
{
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var branches = await github.Repository.GetAllBranches(7528679, options);
|
||||
|
||||
Assert.Equal(5, branches.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsCorrectCountOfBranchesWithStart()
|
||||
{
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1,
|
||||
StartPage = 2
|
||||
};
|
||||
|
||||
var branches = await github.Repository.GetAllBranches("octokit", "octokit.net", options);
|
||||
|
||||
Assert.Equal(5, branches.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsCorrectCountOfBranchesWithStartWithRepositoryId()
|
||||
{
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1,
|
||||
StartPage = 2
|
||||
};
|
||||
|
||||
var branches = await github.Repository.GetAllBranches(7528679, options);
|
||||
|
||||
Assert.Equal(5, branches.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task GetsPagesOfBranches()
|
||||
{
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
|
||||
var firstPageOptions = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
StartPage = 1,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var firstPage = await github.Repository.GetAllBranches("octokit", "octokit.net", firstPageOptions);
|
||||
|
||||
var secondPageOptions = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
StartPage = 2,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var secondPage = await github.Repository.GetAllBranches("octokit", "octokit.net", secondPageOptions);
|
||||
|
||||
Assert.Equal(5, firstPage.Count);
|
||||
Assert.Equal(5, secondPage.Count);
|
||||
|
||||
Assert.NotEqual(firstPage[0].Name, secondPage[0].Name);
|
||||
Assert.NotEqual(firstPage[1].Name, secondPage[1].Name);
|
||||
Assert.NotEqual(firstPage[2].Name, secondPage[2].Name);
|
||||
Assert.NotEqual(firstPage[3].Name, secondPage[3].Name);
|
||||
Assert.NotEqual(firstPage[4].Name, secondPage[4].Name);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task GetsPagesOfBranchesWithRepositoryId()
|
||||
{
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
|
||||
var firstPageOptions = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
StartPage = 1,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var firstPage = await github.Repository.GetAllBranches(7528679, firstPageOptions);
|
||||
|
||||
var secondPageOptions = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
StartPage = 2,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var secondPage = await github.Repository.GetAllBranches(7528679, secondPageOptions);
|
||||
|
||||
Assert.Equal(5, firstPage.Count);
|
||||
Assert.Equal(5, secondPage.Count);
|
||||
|
||||
Assert.NotEqual(firstPage[0].Name, secondPage[0].Name);
|
||||
Assert.NotEqual(firstPage[1].Name, secondPage[1].Name);
|
||||
Assert.NotEqual(firstPage[2].Name, secondPage[2].Name);
|
||||
Assert.NotEqual(firstPage[3].Name, secondPage[3].Name);
|
||||
Assert.NotEqual(firstPage[4].Name, secondPage[4].Name);
|
||||
}
|
||||
}
|
||||
|
||||
public class TheGetBranchMethod
|
||||
{
|
||||
[IntegrationTest]
|
||||
public async Task GetsABranch()
|
||||
{
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
|
||||
var branch = await github.Repository.GetBranch("octokit", "octokit.net", "master");
|
||||
|
||||
Assert.NotNull(branch);
|
||||
Assert.Equal("master", branch.Name);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task GetsABranchWithRepositoryId()
|
||||
{
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
|
||||
var branch = await github.Repository.GetBranch(7528679, "master");
|
||||
|
||||
Assert.NotNull(branch);
|
||||
Assert.Equal("master", branch.Name);
|
||||
}
|
||||
}
|
||||
|
||||
public class TheGetAllTeamsMethod
|
||||
{
|
||||
[IntegrationTest(Skip = "Test requires administration rights to access this endpoint")]
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using Octokit.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
@@ -22,7 +19,7 @@ namespace Octokit.Tests.Integration.Helpers
|
||||
|
||||
var branchFromPath = await fixture.CreateBranch(context.RepositoryOwner, context.RepositoryName, "patch-2", branchFromMaster);
|
||||
|
||||
var allBranchNames = (await client.Repository.GetAllBranches(context.RepositoryOwner, context.RepositoryName)).Select(b => b.Name);
|
||||
var allBranchNames = (await client.Repository.Branch.GetAll(context.RepositoryOwner, context.RepositoryName)).Select(b => b.Name);
|
||||
|
||||
Assert.Contains("patch-1", allBranchNames);
|
||||
Assert.Contains("patch-2", allBranchNames);
|
||||
|
||||
@@ -513,91 +513,6 @@ namespace Octokit.Tests.Clients
|
||||
}
|
||||
}
|
||||
|
||||
public class TheGetAllBranchesMethod
|
||||
{
|
||||
[Fact]
|
||||
public async Task RequestsTheCorrectUrl()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new RepositoriesClient(connection);
|
||||
|
||||
await client.GetAllBranches("owner", "name");
|
||||
|
||||
connection.Received()
|
||||
.GetAll<Branch>(Arg.Is<Uri>(u => u.ToString() == "repos/owner/name/branches"), null, "application/vnd.github.loki-preview+json", Args.ApiOptions);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task RequestsTheCorrectUrlWithRepositoryId()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new RepositoriesClient(connection);
|
||||
|
||||
await client.GetAllBranches(1);
|
||||
|
||||
connection.Received()
|
||||
.GetAll<Branch>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/branches"), null, "application/vnd.github.loki-preview+json", Args.ApiOptions);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task RequestsTheCorrectUrlWithApiOptions()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new RepositoriesClient(connection);
|
||||
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageCount = 1,
|
||||
StartPage = 1,
|
||||
PageSize = 1
|
||||
};
|
||||
|
||||
await client.GetAllBranches("owner", "name", options);
|
||||
|
||||
connection.Received()
|
||||
.GetAll<Branch>(Arg.Is<Uri>(u => u.ToString() == "repos/owner/name/branches"), null, "application/vnd.github.loki-preview+json", options);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task RequestsTheCorrectUrlWithRepositoryIdWithApiOptions()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new RepositoriesClient(connection);
|
||||
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageCount = 1,
|
||||
StartPage = 1,
|
||||
PageSize = 1
|
||||
};
|
||||
|
||||
await client.GetAllBranches(1, options);
|
||||
|
||||
connection.Received()
|
||||
.GetAll<Branch>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/branches"), null, "application/vnd.github.loki-preview+json", options);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EnsuresNonNullArguments()
|
||||
{
|
||||
var client = new RepositoriesClient(Substitute.For<IApiConnection>());
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllBranches(null, "name"));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllBranches("owner", null));
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllBranches(null, "name", ApiOptions.None));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllBranches("owner", null, ApiOptions.None));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllBranches("owner", "name", null));
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllBranches(1, null));
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllBranches("", "name"));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllBranches("owner", ""));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllBranches("", "name", ApiOptions.None));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllBranches("owner", "", ApiOptions.None));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheGetAllContributorsMethod
|
||||
{
|
||||
[Fact]
|
||||
@@ -965,49 +880,6 @@ namespace Octokit.Tests.Clients
|
||||
}
|
||||
}
|
||||
|
||||
public class TheGetBranchMethod
|
||||
{
|
||||
[Fact]
|
||||
public async Task RequestsTheCorrectUrl()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new RepositoriesClient(connection);
|
||||
|
||||
await client.GetBranch("owner", "repo", "branch");
|
||||
|
||||
connection.Received()
|
||||
.Get<Branch>(Arg.Is<Uri>(u => u.ToString() == "repos/owner/repo/branches/branch"), null, "application/vnd.github.loki-preview+json");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task RequestsTheCorrectUrlWithRepositoryId()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new RepositoriesClient(connection);
|
||||
|
||||
await client.GetBranch(1, "branch");
|
||||
|
||||
connection.Received()
|
||||
.Get<Branch>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/branches/branch"), null, "application/vnd.github.loki-preview+json");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EnsuresNonNullArguments()
|
||||
{
|
||||
var client = new RepositoriesClient(Substitute.For<IApiConnection>());
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetBranch(null, "repo", "branch"));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetBranch("owner", null, "branch"));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetBranch("owner", "repo", null));
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetBranch(1, null));
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.GetBranch("", "repo", "branch"));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.GetBranch("owner", "", "branch"));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.GetBranch("owner", "repo", ""));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheEditMethod
|
||||
{
|
||||
[Fact]
|
||||
|
||||
@@ -320,91 +320,6 @@ namespace Octokit.Tests.Reactive
|
||||
}
|
||||
}
|
||||
|
||||
public class TheGetAllBranchesMethod
|
||||
{
|
||||
[Fact]
|
||||
public void RequestsTheCorrectUrl()
|
||||
{
|
||||
var gitHubClient = Substitute.For<IGitHubClient>();
|
||||
var client = new ObservableRepositoriesClient(gitHubClient);
|
||||
var expected = new Uri("repos/owner/repo/branches", UriKind.Relative);
|
||||
|
||||
client.GetAllBranches("owner", "repo");
|
||||
|
||||
gitHubClient.Connection.Received(1).Get<List<Branch>>(expected, Args.EmptyDictionary, null);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RequestsTheCorrectUrlWithRepositoryId()
|
||||
{
|
||||
var gitHubClient = Substitute.For<IGitHubClient>();
|
||||
var client = new ObservableRepositoriesClient(gitHubClient);
|
||||
var expected = new Uri("repositories/1/branches", UriKind.Relative);
|
||||
|
||||
client.GetAllBranches(1);
|
||||
|
||||
gitHubClient.Connection.Received(1).Get<List<Branch>>(expected, Args.EmptyDictionary, null);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RequestsTheCorrectUrlWithApiOptions()
|
||||
{
|
||||
var gitHubClient = Substitute.For<IGitHubClient>();
|
||||
var client = new ObservableRepositoriesClient(gitHubClient);
|
||||
var expected = new Uri("repos/owner/name/branches", UriKind.Relative);
|
||||
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageCount = 1,
|
||||
StartPage = 1,
|
||||
PageSize = 1
|
||||
};
|
||||
|
||||
client.GetAllBranches("owner", "name", options);
|
||||
|
||||
gitHubClient.Connection.Received(1).Get<List<Branch>>(expected, Arg.Is<IDictionary<string, string>>(d => d.Count == 2 && d["page"] == "1" && d["per_page"] == "1"), null);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RequestsTheCorrectUrlWithRepositoryIdWithApiOptions()
|
||||
{
|
||||
var gitHubClient = Substitute.For<IGitHubClient>();
|
||||
var client = new ObservableRepositoriesClient(gitHubClient);
|
||||
var expected = new Uri("repositories/1/branches", UriKind.Relative);
|
||||
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageCount = 1,
|
||||
StartPage = 1,
|
||||
PageSize = 1
|
||||
};
|
||||
|
||||
client.GetAllBranches(1, options);
|
||||
|
||||
gitHubClient.Connection.Received(1).Get<List<Branch>>(expected, Arg.Is<IDictionary<string, string>>(d => d.Count == 2 && d["page"] == "1" && d["per_page"] == "1"), null);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EnsuresNonNullArguments()
|
||||
{
|
||||
var client = new ObservableRepositoriesClient(Substitute.For<IGitHubClient>());
|
||||
|
||||
Assert.Throws<ArgumentNullException>(() => client.GetAllBranches(null, "name"));
|
||||
Assert.Throws<ArgumentNullException>(() => client.GetAllBranches("owner", null));
|
||||
|
||||
Assert.Throws<ArgumentNullException>(() => client.GetAllBranches(null, "name", ApiOptions.None));
|
||||
Assert.Throws<ArgumentNullException>(() => client.GetAllBranches("owner", null, ApiOptions.None));
|
||||
Assert.Throws<ArgumentNullException>(() => client.GetAllBranches("owner", "name", null));
|
||||
|
||||
Assert.Throws<ArgumentNullException>(() => client.GetAllBranches(1, null));
|
||||
|
||||
Assert.Throws<ArgumentException>(() => client.GetAllBranches("", "name"));
|
||||
Assert.Throws<ArgumentException>(() => client.GetAllBranches("owner", ""));
|
||||
Assert.Throws<ArgumentException>(() => client.GetAllBranches("", "name", ApiOptions.None));
|
||||
Assert.Throws<ArgumentException>(() => client.GetAllBranches("owner", "", ApiOptions.None));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheGetCommitMethod
|
||||
{
|
||||
[Fact]
|
||||
@@ -838,49 +753,6 @@ namespace Octokit.Tests.Reactive
|
||||
}
|
||||
}
|
||||
|
||||
public class TheGetBranchMethod
|
||||
{
|
||||
[Fact]
|
||||
public void RequestsTheCorrectUrl()
|
||||
{
|
||||
var github = Substitute.For<IGitHubClient>();
|
||||
var client = new ObservableRepositoriesClient(github);
|
||||
|
||||
client.GetBranch("owner", "repo", "branch");
|
||||
|
||||
github.Repository.Branch.Received(1).Get("owner", "repo", "branch");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RequestsTheCorrectUrlWithRepositoryId()
|
||||
{
|
||||
var github = Substitute.For<IGitHubClient>();
|
||||
var client = new ObservableRepositoriesClient(github);
|
||||
|
||||
client.GetBranch(1, "branch");
|
||||
|
||||
github.Repository.Branch.Received(1).Get(1, "branch");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EnsuresNonNullArguments()
|
||||
{
|
||||
var client = new ObservableRepositoriesClient(Substitute.For<IGitHubClient>());
|
||||
|
||||
Assert.Throws<ArgumentNullException>(() => client.GetBranch(null, "repo", "branch"));
|
||||
Assert.Throws<ArgumentNullException>(() => client.GetBranch("owner", null, "branch"));
|
||||
Assert.Throws<ArgumentNullException>(() => client.GetBranch("owner", "repo", null));
|
||||
|
||||
Assert.Throws<ArgumentNullException>(() => client.GetBranch(1, null));
|
||||
|
||||
Assert.Throws<ArgumentException>(() => client.GetBranch("", "repo", "branch"));
|
||||
Assert.Throws<ArgumentException>(() => client.GetBranch("owner", "", "branch"));
|
||||
Assert.Throws<ArgumentException>(() => client.GetBranch("owner", "repo", ""));
|
||||
|
||||
Assert.Throws<ArgumentException>(() => client.GetBranch(1, ""));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheEditMethod
|
||||
{
|
||||
[Fact]
|
||||
|
||||
@@ -322,58 +322,6 @@ namespace Octokit
|
||||
///</remarks>
|
||||
IMergingClient Merging { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the branches for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/repos/#list-branches">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
/// <returns>All <see cref="T:Octokit.Branch"/>es of the repository</returns>
|
||||
[Obsolete("Please use RepositoriesClient.Branch.GetAll() instead. This method will be removed in a future version")]
|
||||
Task<IReadOnlyList<Branch>> GetAllBranches(string owner, string name);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the branches for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/repos/#list-branches">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
/// <returns>All <see cref="T:Octokit.Branch"/>es of the repository</returns>
|
||||
[Obsolete("Please use RepositoriesClient.Branch.GetAll() instead. This method will be removed in a future version")]
|
||||
Task<IReadOnlyList<Branch>> GetAllBranches(long repositoryId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the branches for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/repos/#list-branches">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
/// <returns>All <see cref="T:Octokit.Branch"/>es of the repository</returns>
|
||||
[Obsolete("Please use RepositoriesClient.Branch.GetAll() instead. This method will be removed in a future version")]
|
||||
Task<IReadOnlyList<Branch>> GetAllBranches(string owner, string name, ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the branches for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/repos/#list-branches">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||
/// <returns>All <see cref="T:Octokit.Branch"/>es of the repository</returns>
|
||||
[Obsolete("Please use RepositoriesClient.Branch.GetAll() instead. This method will be removed in a future version")]
|
||||
Task<IReadOnlyList<Branch>> GetAllBranches(long repositoryId, ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all contributors for the specified repository. Does not include anonymous contributors.
|
||||
/// </summary>
|
||||
@@ -575,31 +523,6 @@ namespace Octokit
|
||||
/// <returns>All of the repositories tags.</returns>
|
||||
Task<IReadOnlyList<RepositoryTag>> GetAllTags(long repositoryId, ApiOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the specified branch.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/repos/#get-branch">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="branchName">The name of the branch</param>
|
||||
/// <returns>The specified <see cref="T:Octokit.Branch"/></returns>
|
||||
[Obsolete("Please use RepositoriesClient.Branch.Get() instead. This method will be removed in a future version")]
|
||||
Task<Branch> GetBranch(string owner, string name, string branchName);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the specified branch.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="http://developer.github.com/v3/repos/#get-branch">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="branchName">The name of the branch</param>
|
||||
/// <returns>The specified <see cref="T:Octokit.Branch"/></returns>
|
||||
[Obsolete("Please use RepositoriesClient.Branch.Get() instead. This method will be removed in a future version")]
|
||||
Task<Branch> GetBranch(long repositoryId, string branchName);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the specified repository with the values given in <paramref name="update"/>
|
||||
/// </summary>
|
||||
|
||||
@@ -162,22 +162,6 @@ namespace Octokit
|
||||
return ApiConnection.Delete(ApiUrls.Repository(repositoryId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the specified branch.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/branches/#get-branch">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="branchName">The name of the branch</param>
|
||||
[Obsolete("Please use RepositoriesClient.Branch.Get() instead. This method will be removed in a future version")]
|
||||
public Task<Branch> GetBranch(long repositoryId, string branchName)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(branchName, "branchName");
|
||||
|
||||
return Branch.Get(repositoryId, branchName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the specified repository with the values given in <paramref name="update"/>
|
||||
/// </summary>
|
||||
@@ -513,71 +497,6 @@ namespace Octokit
|
||||
/// </remarks>
|
||||
public IRepositoryContentsClient Content { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the branches for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/branches/#list-branches">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
[Obsolete("Please use RepositoriesClient.Branch.GetAll() instead. This method will be removed in a future version")]
|
||||
public Task<IReadOnlyList<Branch>> GetAllBranches(string owner, string name)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return Branch.GetAll(owner, name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the branches for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/branches/#list-branches">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
[Obsolete("Please use RepositoriesClient.Branch.GetAll() instead. This method will be removed in a future version")]
|
||||
public Task<IReadOnlyList<Branch>> GetAllBranches(long repositoryId)
|
||||
{
|
||||
return Branch.GetAll(repositoryId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the branches for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/branches/#list-branches">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
[Obsolete("Please use RepositoriesClient.Branch.GetAll() instead. This method will be removed in a future version")]
|
||||
public Task<IReadOnlyList<Branch>> GetAllBranches(string owner, string name, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return Branch.GetAll(owner, name, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the branches for the specified repository.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/branches/#list-branches">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="repositoryId">The Id of the repository</param>
|
||||
/// <param name="options">Options for changing the API response</param>
|
||||
[Obsolete("Please use RepositoriesClient.Branch.GetAll() instead. This method will be removed in a future version")]
|
||||
public Task<IReadOnlyList<Branch>> GetAllBranches(long repositoryId, ApiOptions options)
|
||||
{
|
||||
Ensure.ArgumentNotNull(options, "options");
|
||||
|
||||
return Branch.GetAll(repositoryId, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all contributors for the specified repository. Does not include anonymous contributors.
|
||||
/// </summary>
|
||||
@@ -888,25 +807,6 @@ namespace Octokit
|
||||
return ApiConnection.GetAll<RepositoryTag>(ApiUrls.RepositoryTags(repositoryId), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the specified branch.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/repos/branches/#get-branch">API documentation</a> for more details
|
||||
/// </remarks>
|
||||
/// <param name="owner">The owner of the repository</param>
|
||||
/// <param name="name">The name of the repository</param>
|
||||
/// <param name="branchName">The name of the branch</param>
|
||||
[Obsolete("Please use RepositoriesClient.Branch.Get() instead. This method will be removed in a future version")]
|
||||
public Task<Branch> GetBranch(string owner, string name, string branchName)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
Ensure.ArgumentNotNullOrEmptyString(branchName, "branchName");
|
||||
|
||||
return Branch.Get(owner, name, branchName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A client for GitHub's Repository Pages API.
|
||||
/// </summary>
|
||||
|
||||
@@ -29,12 +29,6 @@ namespace Octokit
|
||||
/// </summary>
|
||||
public string CommitTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Commit a single commit to the head branch (optional)
|
||||
/// </summary>
|
||||
[Obsolete("Please use MergeMethod property. This property will no longer be supported by the GitHub API and will be removed in a future version")]
|
||||
public bool Squash { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Specify the Merge method to use (optional - default is Merge)
|
||||
/// </summary>
|
||||
|
||||
@@ -24,14 +24,6 @@ namespace Octokit
|
||||
/// </summary>
|
||||
public DeploymentState State { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The target URL to associate with this status. This URL should contain
|
||||
/// output to keep the user updated while the task is running or serve as
|
||||
/// historical information for what happened in the deployment
|
||||
/// </summary>
|
||||
[Obsolete("This property is obsolete. Use LogUrl instead.", false)]
|
||||
public string TargetUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The target URL to associate with this status. This URL should contain
|
||||
/// output to keep the user updated while the task is running or serve as
|
||||
|
||||
@@ -10,18 +10,6 @@ namespace Octokit
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class PublicRepositoryRequest : RequestParameters
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PublicRepositoryRequest"/> class.
|
||||
/// </summary>
|
||||
/// <param name="since">The integer Id of the last Repository that you’ve seen.</param>
|
||||
[Obsolete("Please use the alternative constructor taking a long, rather than int, typed parameter. This constructor will be removed in a future release.")]
|
||||
public PublicRepositoryRequest(int since)
|
||||
{
|
||||
Ensure.ArgumentNotNull(since, "since");
|
||||
|
||||
Since = since;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PublicRepositoryRequest"/> class.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user