mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-07 20:30:41 +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:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user