diff --git a/Octokit.Tests/Clients/DeploymentsClientTests.cs b/Octokit.Tests/Clients/DeploymentsClientTests.cs index a448adbe..f4863970 100644 --- a/Octokit.Tests/Clients/DeploymentsClientTests.cs +++ b/Octokit.Tests/Clients/DeploymentsClientTests.cs @@ -18,8 +18,8 @@ public class DeploymentsClientTests { var client = new DeploymentsClient(Substitute.For()); - Assert.Throws(() => client.GetAll(null, "name")); - Assert.Throws(() => client.GetAll("owner", null)); + await AssertEx.Throws(() => client.GetAll(null, "name")); + await AssertEx.Throws(() => client.GetAll("owner", null)); } [Fact] @@ -27,8 +27,8 @@ public class DeploymentsClientTests { var client = new DeploymentsClient(Substitute.For()); - Assert.Throws(() => client.GetAll("", "name")); - Assert.Throws(() => client.GetAll("owner", "")); + await AssertEx.Throws(() => client.GetAll("", "name")); + await AssertEx.Throws(() => client.GetAll("owner", "")); } [Theory] @@ -76,22 +76,22 @@ public class DeploymentsClientTests readonly NewDeployment newDeployment = new NewDeployment { Ref = "aRef" }; [Fact] - public void EnsuresNonNullArguments() + public async Task EnsuresNonNullArguments() { var client = new DeploymentsClient(Substitute.For()); - AssertEx.Throws(() => client.Create(null, "name", newDeployment)); - AssertEx.Throws(() => client.Create("owner", null, newDeployment)); - AssertEx.Throws(() => client.Create("owner", "name", null)); + await AssertEx.Throws(() => client.Create(null, "name", newDeployment)); + await AssertEx.Throws(() => client.Create("owner", null, newDeployment)); + await AssertEx.Throws(() => client.Create("owner", "name", null)); } [Fact] - public void EnsuresNonEmptyArguments() + public async Task EnsuresNonEmptyArguments() { var client = new DeploymentsClient(Substitute.For()); - Assert.Throws(() => client.Create("", "name", newDeployment)); - Assert.Throws(() => client.Create("owner", "", newDeployment)); + await AssertEx.Throws(() => client.Create("", "name", newDeployment)); + await AssertEx.Throws(() => client.Create("owner", "", newDeployment)); } [Theory] @@ -100,12 +100,12 @@ public class DeploymentsClientTests [InlineData("\t")] [InlineData(" ")] [InlineData("\n\r")] - public void EnsuresNonWhitespaceArguments(string whitespace) + public async Task EnsuresNonWhitespaceArguments(string whitespace) { var client = new DeploymentsClient(Substitute.For()); - Assert.Throws(() => client.Create(whitespace, "name", newDeployment)); - Assert.Throws(() => client.Create("owner", whitespace, newDeployment)); + await AssertEx.Throws(() => client.Create(whitespace, "name", newDeployment)); + await AssertEx.Throws(() => client.Create("owner", whitespace, newDeployment)); } [Fact] diff --git a/Octokit.Tests/Clients/PullRequestsClientTests.cs b/Octokit.Tests/Clients/PullRequestsClientTests.cs index 8864231e..6807be0c 100644 --- a/Octokit.Tests/Clients/PullRequestsClientTests.cs +++ b/Octokit.Tests/Clients/PullRequestsClientTests.cs @@ -28,10 +28,10 @@ namespace Octokit.Tests.Clients { var client = new PullRequestsClient(Substitute.For()); - await AssertEx.Throws(async () => await client.Get(null, "name", 1)); - await AssertEx.Throws(async () => await client.Get("owner", null, 1)); - await AssertEx.Throws(async () => await client.Get(null, "", 1)); - await AssertEx.Throws(async () => await client.Get("", null, 1)); + await AssertEx.Throws(() => client.Get(null, "name", 1)); + await AssertEx.Throws(() => client.Get("owner", null, 1)); + await AssertEx.Throws(() => client.Get(null, "", 1)); + await AssertEx.Throws(() => client.Get("", null, 1)); } } @@ -86,15 +86,15 @@ namespace Octokit.Tests.Clients var connection = Substitute.For(); var client = new PullRequestsClient(connection); - AssertEx.Throws(async () => await + await AssertEx.Throws(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2"))); - AssertEx.Throws(async () => await + await AssertEx.Throws(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2"))); - AssertEx.Throws(async () => await + await AssertEx.Throws(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2"))); - AssertEx.Throws(async () => await + await AssertEx.Throws(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2"))); - AssertEx.Throws(async () => await + await AssertEx.Throws(() => client.Create("owner", "name", null)); } } @@ -120,15 +120,15 @@ namespace Octokit.Tests.Clients var connection = Substitute.For(); var client = new PullRequestsClient(connection); - AssertEx.Throws(async () => await + await AssertEx.Throws(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2"))); - AssertEx.Throws(async () => await + await AssertEx.Throws(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2"))); - AssertEx.Throws(async () => await + await AssertEx.Throws(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2"))); - AssertEx.Throws(async () => await + await AssertEx.Throws(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2"))); - AssertEx.Throws(async () => await + await AssertEx.Throws(() => client.Create("owner", "name", null)); } } @@ -154,11 +154,11 @@ namespace Octokit.Tests.Clients var connection = Substitute.For(); var client = new PullRequestsClient(connection); - AssertEx.Throws(async () => await + await AssertEx.Throws(() => client.Merge(null, "name", 42, new MergePullRequest("message"))); - AssertEx.Throws(async () => await + await AssertEx.Throws(() => client.Merge("owner", null, 42, new MergePullRequest("message"))); - AssertEx.Throws(async () => await + await AssertEx.Throws(() => client.Merge("owner", "name", 42, null)); } } @@ -185,10 +185,10 @@ namespace Octokit.Tests.Clients var connection = Substitute.For(); var client = new PullRequestsClient(connection); - await AssertEx.Throws(async () => await client.Merged(null, "name", 1)); - await AssertEx.Throws(async () => await client.Merged("owner", null, 1)); - await AssertEx.Throws(async () => await client.Merged(null, "", 1)); - await AssertEx.Throws(async () => await client.Merged("", null, 1)); + await AssertEx.Throws(() => client.Merged(null, "name", 1)); + await AssertEx.Throws(() => client.Merged("owner", null, 1)); + await AssertEx.Throws(() => client.Merged(null, "", 1)); + await AssertEx.Throws(() => client.Merged("", null, 1)); } } @@ -211,10 +211,10 @@ namespace Octokit.Tests.Clients var connection = Substitute.For(); var client = new PullRequestsClient(connection); - await AssertEx.Throws(async () => await client.Commits(null, "name", 1)); - await AssertEx.Throws(async () => await client.Commits("owner", null, 1)); - await AssertEx.Throws(async () => await client.Commits(null, "", 1)); - await AssertEx.Throws(async () => await client.Commits("", null, 1)); + await AssertEx.Throws(() => client.Commits(null, "name", 1)); + await AssertEx.Throws(() => client.Commits("owner", null, 1)); + await AssertEx.Throws(() => client.Commits(null, "", 1)); + await AssertEx.Throws(() => client.Commits("", null, 1)); } } diff --git a/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs b/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs index 80dd030f..af584971 100644 --- a/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs @@ -170,15 +170,15 @@ namespace Octokit.Tests.Reactive var gitHubClient = Substitute.For(); var client = new ObservablePullRequestsClient(gitHubClient); - AssertEx.Throws(async () => await + Assert.Throws(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2"))); - AssertEx.Throws(async () => await + Assert.Throws(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2"))); - AssertEx.Throws(async () => await + Assert.Throws(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2"))); - AssertEx.Throws(async () => await + Assert.Throws(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2"))); - AssertEx.Throws(async () => await + Assert.Throws(() => client.Create("owner", "name", null)); } } @@ -203,15 +203,15 @@ namespace Octokit.Tests.Reactive var gitHubClient = Substitute.For(); var client = new ObservablePullRequestsClient(gitHubClient); - AssertEx.Throws(async () => await + Assert.Throws(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2"))); - AssertEx.Throws(async () => await + Assert.Throws(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2"))); - AssertEx.Throws(async () => await + Assert.Throws(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2"))); - AssertEx.Throws(async () => await + Assert.Throws(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2"))); - AssertEx.Throws(async () => await + Assert.Throws(() => client.Create("owner", "name", null)); } } @@ -236,11 +236,11 @@ namespace Octokit.Tests.Reactive var connection = Substitute.For(); var client = new PullRequestsClient(connection); - AssertEx.Throws(async () => await + Assert.Throws(() => client.Merge(null, "name", 42, new MergePullRequest("message"))); - AssertEx.Throws(async () => await + Assert.Throws(() => client.Merge("owner", null, 42, new MergePullRequest("message"))); - AssertEx.Throws(async () => await + Assert.Throws(() => client.Merge("owner", "name", 42, null)); } }