From 0ee2f35dad9f02e7e385cfe34f498cd0a275a9d4 Mon Sep 17 00:00:00 2001 From: Mordechai Zuber Date: Mon, 11 May 2015 17:51:23 +0300 Subject: [PATCH] tests for clients for Gists, IssueComments, IssueClient use Assert.ThrowsAsync --- Octokit.Tests/Clients/GistsClientTests.cs | 2 +- .../Clients/IssueCommentsClientTests.cs | 52 +++++++++---------- Octokit.Tests/Clients/IssuesClientTests.cs | 4 +- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Octokit.Tests/Clients/GistsClientTests.cs b/Octokit.Tests/Clients/GistsClientTests.cs index 9bb21e52..fa627076 100644 --- a/Octokit.Tests/Clients/GistsClientTests.cs +++ b/Octokit.Tests/Clients/GistsClientTests.cs @@ -259,7 +259,7 @@ public class GistsClientTests var client = new GistsClient(apiConnection); - await AssertEx.Throws(async () => await client.IsStarred("1")); + await Assert.ThrowsAsync(() => client.IsStarred("1")); } } diff --git a/Octokit.Tests/Clients/IssueCommentsClientTests.cs b/Octokit.Tests/Clients/IssueCommentsClientTests.cs index 3fda4b96..0ea7cf06 100644 --- a/Octokit.Tests/Clients/IssueCommentsClientTests.cs +++ b/Octokit.Tests/Clients/IssueCommentsClientTests.cs @@ -29,10 +29,10 @@ public class IssueCommentsClientTests { var client = new IssueCommentsClient(Substitute.For()); - await AssertEx.Throws(async () => await client.Get(null, "name", 1)); - await AssertEx.Throws(async () => await client.Get("", "name", 1)); - await AssertEx.Throws(async () => await client.Get("owner", null, 1)); - await AssertEx.Throws(async () => await client.Get("owner", "", 1)); + await Assert.ThrowsAsync(() => client.Get(null, "name", 1)); + await Assert.ThrowsAsync(() => client.Get("", "name", 1)); + await Assert.ThrowsAsync(() => client.Get("owner", null, 1)); + await Assert.ThrowsAsync(() => client.Get("owner", "", 1)); } } @@ -56,10 +56,10 @@ public class IssueCommentsClientTests var connection = Substitute.For(); var client = new IssueCommentsClient(connection); - await AssertEx.Throws(async () => await client.GetAllForRepository(null, "name")); - await AssertEx.Throws(async () => await client.GetAllForRepository("", "name")); - await AssertEx.Throws(async () => await client.GetAllForRepository("owner", null)); - await AssertEx.Throws(async () => await client.GetAllForRepository("owner", "")); + await Assert.ThrowsAsync(() => client.GetAllForRepository(null, "name")); + await Assert.ThrowsAsync(() => client.GetAllForRepository("", "name")); + await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", null)); + await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", "")); } } @@ -82,10 +82,10 @@ public class IssueCommentsClientTests var connection = Substitute.For(); var client = new IssueCommentsClient(connection); - await AssertEx.Throws(async () => await client.GetAllForIssue(null, "name", 1)); - await AssertEx.Throws(async () => await client.GetAllForIssue("", "name", 1)); - await AssertEx.Throws(async () => await client.GetAllForIssue("owner", null, 1)); - await AssertEx.Throws(async () => await client.GetAllForIssue("owner", "", 1)); + await Assert.ThrowsAsync(() => client.GetAllForIssue(null, "name", 1)); + await Assert.ThrowsAsync(() => client.GetAllForIssue("", "name", 1)); + await Assert.ThrowsAsync(() => client.GetAllForIssue("owner", null, 1)); + await Assert.ThrowsAsync(() => client.GetAllForIssue("owner", "", 1)); } } @@ -109,11 +109,11 @@ public class IssueCommentsClientTests var connection = Substitute.For(); var client = new IssueCommentsClient(connection); - await AssertEx.Throws(async () => await client.Create(null, "name", 1, "title")); - await AssertEx.Throws(async () => await client.Create("", "name", 1, "x")); - await AssertEx.Throws(async () => await client.Create("owner", null, 1, "x")); - await AssertEx.Throws(async () => await client.Create("owner", "", 1, "x")); - await AssertEx.Throws(async () => await client.Create("owner", "name", 1, null)); + await Assert.ThrowsAsync(() => client.Create(null, "name", 1, "title")); + await Assert.ThrowsAsync(() => client.Create("", "name", 1, "x")); + await Assert.ThrowsAsync(() => client.Create("owner", null, 1, "x")); + await Assert.ThrowsAsync(() => client.Create("owner", "", 1, "x")); + await Assert.ThrowsAsync(() => client.Create("owner", "name", 1, null)); } } @@ -137,11 +137,11 @@ public class IssueCommentsClientTests var connection = Substitute.For(); var client = new IssueCommentsClient(connection); - await AssertEx.Throws(async () => await client.Update(null, "name", 42, "title")); - await AssertEx.Throws(async () => await client.Update("", "name", 42, "x")); - await AssertEx.Throws(async () => await client.Update("owner", null, 42, "x")); - await AssertEx.Throws(async () => await client.Update("owner", "", 42, "x")); - await AssertEx.Throws(async () => await client.Update("owner", "name", 42, null)); + await Assert.ThrowsAsync(() => client.Update(null, "name", 42, "title")); + await Assert.ThrowsAsync(() => client.Update("", "name", 42, "x")); + await Assert.ThrowsAsync(() => client.Update("owner", null, 42, "x")); + await Assert.ThrowsAsync(() => client.Update("owner", "", 42, "x")); + await Assert.ThrowsAsync(() => client.Update("owner", "name", 42, null)); } } @@ -164,10 +164,10 @@ public class IssueCommentsClientTests var connection = Substitute.For(); var client = new IssueCommentsClient(connection); - await AssertEx.Throws(async () => await client.Delete(null, "name", 42)); - await AssertEx.Throws(async () => await client.Delete("", "name", 42)); - await AssertEx.Throws(async () => await client.Delete("owner", null, 42)); - await AssertEx.Throws(async () => await client.Delete("owner", "", 42)); + await Assert.ThrowsAsync(() => client.Delete(null, "name", 42)); + await Assert.ThrowsAsync(() => client.Delete("", "name", 42)); + await Assert.ThrowsAsync(() => client.Delete("owner", null, 42)); + await Assert.ThrowsAsync(() => client.Delete("owner", "", 42)); } } diff --git a/Octokit.Tests/Clients/IssuesClientTests.cs b/Octokit.Tests/Clients/IssuesClientTests.cs index 54ceaee8..c8b6c798 100644 --- a/Octokit.Tests/Clients/IssuesClientTests.cs +++ b/Octokit.Tests/Clients/IssuesClientTests.cs @@ -30,8 +30,8 @@ namespace Octokit.Tests.Clients { var client = new IssuesClient(Substitute.For()); - await AssertEx.Throws(async () => await client.Get(null, "name", 1)); - await AssertEx.Throws(async () => await client.Get("owner", null, 1)); + await Assert.ThrowsAsync(() => client.Get(null, "name", 1)); + await Assert.ThrowsAsync(() => client.Get("owner", null, 1)); } }