Skip to content

Commit

Permalink
Update NewPulRequest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyberboss committed Feb 27, 2018
1 parent 8276b1e commit f20dfa7
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ async Task<PullRequestData> CreatePullRequest(RepositoryContext context)

// Creating a pull request

var pullRequest = new NewPullRequest("Nice title for the pull request", branchName, "master");
var pullRequest = new NewPullRequest("Nice title for the pull request", branchName, "master", false);
var createdPullRequest = await _github.PullRequest.Create(Helper.UserName, repoName, pullRequest);

var data = new PullRequestData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ async Task<PullRequestData> CreatePullRequest(RepositoryContext context, string

// Creating a pull request

var pullRequest = new NewPullRequest("Nice title for the pull request", branch, "master");
var pullRequest = new NewPullRequest("Nice title for the pull request", branch, "master", false);
var createdPullRequest = await _github.PullRequest.Create(Helper.UserName, repoName, pullRequest);

var data = new PullRequestData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ static async Task<int> CreateTheWorld(IGitHubClient github, RepositoryContext co
await github.Git.Reference.Create(context.RepositoryOwner, context.RepositoryName, new NewReference("refs/heads/my-branch", featureBranchCommit2.Sha));

// create a pull request
var pullRequest = new NewPullRequest("Nice title for the pull request", "my-branch", "master");
var pullRequest = new NewPullRequest("Nice title for the pull request", "my-branch", "master", false);
var createdPullRequest = await github.PullRequest.Create(context.RepositoryOwner, context.RepositoryName, pullRequest);

// Create review requests (optional)
Expand Down
110 changes: 56 additions & 54 deletions Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Octokit.Tests.Integration/Helpers/RepositorySetupHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static async Task<Reference> CreateTheWorld(this IGitHubClient client, Re

public static async Task<PullRequest> CreatePullRequest(this IGitHubClient client, Repository repository, string branch = "my-branch")
{
var pullRequest = new NewPullRequest("Nice title for the pull request", branch, "master");
var pullRequest = new NewPullRequest("Nice title for the pull request", branch, "master", false);
var createdPullRequest = await client.PullRequest.Create(repository.Owner.Login, repository.Name, pullRequest);

return createdPullRequest;
Expand Down
20 changes: 10 additions & 10 deletions Octokit.Tests/Clients/PullRequestsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public class TheCreateMethod
[Fact]
public async Task PostsToCorrectUrl()
{
var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name");
var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name", false);
var connection = Substitute.For<IApiConnection>();
var client = new PullRequestsClient(connection);

Expand All @@ -249,7 +249,7 @@ public async Task PostsToCorrectUrl()
[Fact]
public async Task PostsToCorrectUrlWithRepositoryId()
{
var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name");
var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name", false);
var connection = Substitute.For<IApiConnection>();
var client = new PullRequestsClient(connection);

Expand All @@ -265,14 +265,14 @@ public async Task EnsuresNonNullArguments()
var connection = Substitute.For<IApiConnection>();
var client = new PullRequestsClient(connection);

await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2")));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2")));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2", false)));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2", false)));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create("owner", "name", null));

await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create(1, null));

await Assert.ThrowsAsync<ArgumentException>(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2")));
await Assert.ThrowsAsync<ArgumentException>(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2")));
await Assert.ThrowsAsync<ArgumentException>(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2", false)));
await Assert.ThrowsAsync<ArgumentException>(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2", false)));
}
}

Expand Down Expand Up @@ -310,14 +310,14 @@ public async Task EnsuresNonNullArguments()
var connection = Substitute.For<IApiConnection>();
var client = new PullRequestsClient(connection);

await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2")));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2")));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2", false)));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2", false)));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create("owner", "name", null));

await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create(1, null));

await Assert.ThrowsAsync<ArgumentException>(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2")));
await Assert.ThrowsAsync<ArgumentException>(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2")));
await Assert.ThrowsAsync<ArgumentException>(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2", false)));
await Assert.ThrowsAsync<ArgumentException>(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2", false)));
}
}

Expand Down
12 changes: 6 additions & 6 deletions Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ public class TheCreateMethod
[Fact]
public void CreatesFromClientRepositoryPullRequest()
{
var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name");
var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name", false);
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservablePullRequestsClient(gitHubClient);

Expand All @@ -474,7 +474,7 @@ public void CreatesFromClientRepositoryPullRequest()
[Fact]
public void CreatesFromClientRepositoryPullRequestWithRepositoryId()
{
var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name");
var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name", false);
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservablePullRequestsClient(gitHubClient);

Expand All @@ -489,14 +489,14 @@ public void EnsuresNonNullArguments()
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservablePullRequestsClient(gitHubClient);

Assert.Throws<ArgumentNullException>(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2")));
Assert.Throws<ArgumentNullException>(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2")));
Assert.Throws<ArgumentNullException>(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2", false)));
Assert.Throws<ArgumentNullException>(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2", false)));
Assert.Throws<ArgumentNullException>(() => client.Create("owner", "name", null));

Assert.Throws<ArgumentNullException>(() => client.Create(1, null));

Assert.Throws<ArgumentException>(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2")));
Assert.Throws<ArgumentException>(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2")));
Assert.Throws<ArgumentException>(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2", false)));
Assert.Throws<ArgumentException>(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2", false)));
}
}

Expand Down

0 comments on commit f20dfa7

Please sign in to comment.