diff --git a/Octokit.Tests/Http/ApiConnectionTests.cs b/Octokit.Tests/Http/ApiConnectionTests.cs index ad4e34af..909c2b10 100644 --- a/Octokit.Tests/Http/ApiConnectionTests.cs +++ b/Octokit.Tests/Http/ApiConnectionTests.cs @@ -51,8 +51,8 @@ namespace Octokit.Tests.Http { var getUri = new Uri("anything", UriKind.Relative); var client = new ApiConnection(Substitute.For()); - await AssertEx.Throws(async () => await client.Get(null)); - await AssertEx.Throws(async () => await client.Get(getUri, new Dictionary(), null)); + await Assert.ThrowsAsync(() => client.Get(null)); + await Assert.ThrowsAsync(() => client.Get(getUri, new Dictionary(), null)); } } @@ -77,7 +77,7 @@ namespace Octokit.Tests.Http public async Task EnsuresArgumentNotNull() { var client = new ApiConnection(Substitute.For()); - await AssertEx.Throws(async () => await client.GetHtml(null)); + await Assert.ThrowsAsync(() => client.GetHtml(null)); } } @@ -106,14 +106,14 @@ namespace Octokit.Tests.Http var client = new ApiConnection(Substitute.For()); // One argument - await AssertEx.Throws(async () => await client.GetAll(null)); + await Assert.ThrowsAsync(() => client.GetAll(null)); // Two argument - await AssertEx.Throws(async () => + await Assert.ThrowsAsync(async () => await client.GetAll(null, new Dictionary())); // Three arguments - await AssertEx.Throws(async () => + await Assert.ThrowsAsync(async () => await client.GetAll(null, new Dictionary(), "accepts")); } } @@ -158,9 +158,9 @@ namespace Octokit.Tests.Http { var connection = new ApiConnection(Substitute.For()); var patchUri = new Uri("", UriKind.Relative); - await AssertEx.Throws(async () => await connection.Patch(null, new object())); - await AssertEx.Throws(async () => await connection.Patch(patchUri, null)); - await AssertEx.Throws(async () => await connection.Patch(patchUri, new object(), null)); + await Assert.ThrowsAsync(() => connection.Patch(null, new object())); + await Assert.ThrowsAsync(() => connection.Patch(patchUri, null)); + await Assert.ThrowsAsync(() => connection.Patch(patchUri, new object(), null)); } } @@ -219,15 +219,15 @@ namespace Octokit.Tests.Http var connection = new ApiConnection(Substitute.For()); // 1 parameter overload - await Assert.ThrowsAsync(async () => await connection.Post(null)); + await Assert.ThrowsAsync(() => connection.Post(null)); // 2 parameter overload - await Assert.ThrowsAsync(async () => await connection.Post(null, new object())); - await Assert.ThrowsAsync(async () => await connection.Post(postUri, null)); + await Assert.ThrowsAsync(() => connection.Post(null, new object())); + await Assert.ThrowsAsync(() => connection.Post(postUri, null)); // 3 parameters - await Assert.ThrowsAsync(async () => await connection.Post(null, new MemoryStream(), "anAccept", "some-content-type")); - await Assert.ThrowsAsync(async () => await connection.Post(postUri, null, "anAccept", "some-content-type")); + await Assert.ThrowsAsync(() => connection.Post(null, new MemoryStream(), "anAccept", "some-content-type")); + await Assert.ThrowsAsync(() => connection.Post(postUri, null, "anAccept", "some-content-type")); } } @@ -272,19 +272,19 @@ namespace Octokit.Tests.Http var connection = new ApiConnection(Substitute.For()); // 2 parameter overload - await AssertEx.Throws(async () => + await Assert.ThrowsAsync(async () => await connection.Put(null, new object())); - await AssertEx.Throws(async () => + await Assert.ThrowsAsync(async () => await connection.Put(putUri, null)); // 3 parameters - await AssertEx.Throws(async () => + await Assert.ThrowsAsync(async () => await connection.Put(null, new MemoryStream(), "two-factor")); - await AssertEx.Throws(async () => + await Assert.ThrowsAsync(async () => await connection.Put(putUri, null, "two-factor")); - await AssertEx.Throws(async () => + await Assert.ThrowsAsync(async () => await connection.Put(putUri, new MemoryStream(), null)); - await AssertEx.Throws(async () => + await Assert.ThrowsAsync(async () => await connection.Put(putUri, new MemoryStream(), "")); } } @@ -309,7 +309,7 @@ namespace Octokit.Tests.Http public async Task EnsuresArgumentNotNull() { var connection = new ApiConnection(Substitute.For()); - await AssertEx.Throws(async () => await connection.Delete(null)); + await Assert.ThrowsAsync(() => connection.Delete(null)); } } @@ -342,7 +342,7 @@ namespace Octokit.Tests.Http connection.GetResponse(queuedOperationUrl, Args.CancellationToken).Returns(Task.FromResult(response)); var apiConnection = new ApiConnection(connection); - await AssertEx.Throws(async () => await apiConnection.GetQueuedOperation(queuedOperationUrl, Args.CancellationToken)); + await Assert.ThrowsAsync(() => apiConnection.GetQueuedOperation(queuedOperationUrl, Args.CancellationToken)); } [Fact] @@ -413,7 +413,7 @@ namespace Octokit.Tests.Http public async Task EnsuresArgumentNotNull() { var connection = new ApiConnection(Substitute.For()); - await AssertEx.Throws(async () => await connection.GetQueuedOperation(null, CancellationToken.None)); + await Assert.ThrowsAsync(() => connection.GetQueuedOperation(null, CancellationToken.None)); } } diff --git a/Octokit.Tests/Http/ConnectionTests.cs b/Octokit.Tests/Http/ConnectionTests.cs index 3e352839..d0bfd7ca 100644 --- a/Octokit.Tests/Http/ConnectionTests.cs +++ b/Octokit.Tests/Http/ConnectionTests.cs @@ -97,8 +97,8 @@ namespace Octokit.Tests.Http httpClient, Substitute.For()); - var exception = await AssertEx.Throws( - async () => await connection.GetResponse(new Uri("endpoint", UriKind.Relative))); + var exception = await Assert.ThrowsAsync( + () => connection.GetResponse(new Uri("endpoint", UriKind.Relative))); Assert.NotNull(exception); } @@ -121,8 +121,8 @@ namespace Octokit.Tests.Http httpClient, Substitute.For()); - var exception = await AssertEx.Throws( - async () => await connection.GetResponse(new Uri("endpoint", UriKind.Relative))); + var exception = await Assert.ThrowsAsync( + () => connection.GetResponse(new Uri("endpoint", UriKind.Relative))); Assert.Equal(HttpStatusCode.Unauthorized, exception.StatusCode); } @@ -148,8 +148,8 @@ namespace Octokit.Tests.Http httpClient, Substitute.For()); - var exception = await AssertEx.Throws( - async () => await connection.GetResponse(new Uri("endpoint", UriKind.Relative))); + var exception = await Assert.ThrowsAsync( + () => connection.GetResponse(new Uri("endpoint", UriKind.Relative))); Assert.Equal(expectedFactorType, exception.TwoFactorType); } @@ -172,8 +172,8 @@ namespace Octokit.Tests.Http httpClient, Substitute.For()); - var exception = await AssertEx.Throws( - async () => await connection.GetResponse(new Uri("endpoint", UriKind.Relative))); + var exception = await Assert.ThrowsAsync( + () => connection.GetResponse(new Uri("endpoint", UriKind.Relative))); Assert.Equal("Validation Failed", exception.Message); Assert.Equal("key is already in use", exception.ApiError.Errors[0].Message); @@ -196,8 +196,8 @@ namespace Octokit.Tests.Http httpClient, Substitute.For()); - var exception = await AssertEx.Throws( - async () => await connection.GetResponse(new Uri("endpoint", UriKind.Relative))); + var exception = await Assert.ThrowsAsync( + () => connection.GetResponse(new Uri("endpoint", UriKind.Relative))); Assert.Equal("API rate limit exceeded. See http://developer.github.com/v3/#rate-limiting for details.", exception.Message); @@ -220,8 +220,8 @@ namespace Octokit.Tests.Http httpClient, Substitute.For()); - var exception = await AssertEx.Throws( - async () => await connection.GetResponse(new Uri("endpoint", UriKind.Relative))); + var exception = await Assert.ThrowsAsync( + () => connection.GetResponse(new Uri("endpoint", UriKind.Relative))); Assert.Equal("Maximum number of login attempts exceeded", exception.Message); Assert.Equal("http://developer.github.com/v3", exception.ApiError.DocumentationUrl); @@ -244,8 +244,8 @@ namespace Octokit.Tests.Http httpClient, Substitute.For()); - var exception = await AssertEx.Throws( - async () => await connection.GetResponse(new Uri("endpoint", UriKind.Relative))); + var exception = await Assert.ThrowsAsync( + () => connection.GetResponse(new Uri("endpoint", UriKind.Relative))); Assert.Equal("GONE BYE BYE!", exception.Message); } @@ -266,8 +266,8 @@ namespace Octokit.Tests.Http httpClient, Substitute.For()); - var exception = await AssertEx.Throws( - async () => await connection.GetResponse(new Uri("endpoint", UriKind.Relative))); + var exception = await Assert.ThrowsAsync( + () => connection.GetResponse(new Uri("endpoint", UriKind.Relative))); Assert.Equal("YOU SHALL NOT PASS!", exception.Message); }