Skip to content

Commit

Permalink
cleanup related tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftkey committed Mar 5, 2020
1 parent 2c8455d commit 9e2f7f2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 123 deletions.
66 changes: 1 addition & 65 deletions Octokit.Tests/Clients/CheckSuitesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,70 +332,6 @@ public async Task EnsuresNonEmptyArguments()
}
}

#pragma warning disable CS0618 // Type or member is obsolete
public class TheRequestMethod
{
[Fact]
public async Task RequestsCorrectUrl()
{
var connection = MockedIApiConnection.PostReturnsHttpStatus(HttpStatusCode.Created);
var client = new CheckSuitesClient(connection);

var request = new CheckSuiteTriggerRequest("123abc");

await client.Request("fake", "repo", request);

connection.Connection.Received().Post(
Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/check-suite-requests"),
request,
"application/vnd.github.antiope-preview+json");
}

[Fact]
public async Task RequestsCorrectUrlWithRepositoryId()
{
var connection = MockedIApiConnection.PostReturnsHttpStatus(HttpStatusCode.Created);
var client = new CheckSuitesClient(connection);

var request = new CheckSuiteTriggerRequest("123abc");

await client.Request(1, request);

connection.Connection.Received().Post(
Arg.Is<Uri>(u => u.ToString() == "repositories/1/check-suite-requests"),
request,
"application/vnd.github.antiope-preview+json");
}

[Fact]
public async Task EnsuresNonNullArguments()
{
var connection = Substitute.For<IApiConnection>();
var client = new CheckSuitesClient(connection);

var request = new CheckSuiteTriggerRequest("123abc");

await Assert.ThrowsAsync<ArgumentNullException>(() => client.Request(null, "repo", request));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Request("fake", null, request));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Request("fake", "repo", null));

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

[Fact]
public async Task EnsuresNonEmptyArguments()
{
var connection = Substitute.For<IApiConnection>();
var client = new CheckSuitesClient(connection);

var request = new CheckSuiteTriggerRequest("123abc");

await Assert.ThrowsAsync<ArgumentException>(() => client.Request("", "repo", request));
await Assert.ThrowsAsync<ArgumentException>(() => client.Request("fake", "", request));
}
}
#pragma warning restore CS0618 // Type or member is obsolete

public class TheRerequestMethod
{
[Fact]
Expand Down Expand Up @@ -447,4 +383,4 @@ public async Task EnsuresNonEmptyArguments()
}
}
}
}
}
58 changes: 0 additions & 58 deletions Octokit.Tests/Reactive/ObservableCheckSuitesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,64 +313,6 @@ public async Task EnsuresNonEmptyArguments()
}
}

#pragma warning disable CS0618 // Type or member is obsolete
public class TheRequestMethod
{
[Fact]
public async Task RequestsCorrectUrl()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservableCheckSuitesClient(gitHubClient);

var request = new CheckSuiteTriggerRequest("123abc");

client.Request("fake", "repo", request);

gitHubClient.Check.Suite.Received().Request("fake", "repo", request);
}

[Fact]
public async Task RequestsCorrectUrlWithRepositoryId()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservableCheckSuitesClient(gitHubClient);

var request = new CheckSuiteTriggerRequest("123abc");

client.Request(1, request);

gitHubClient.Check.Suite.Received().Request(1, request);
}

[Fact]
public async Task EnsuresNonNullArguments()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservableCheckSuitesClient(gitHubClient);

var request = new CheckSuiteTriggerRequest("123abc");

Assert.Throws<ArgumentNullException>(() => client.Request(null, "repo", request));
Assert.Throws<ArgumentNullException>(() => client.Request("fake", null, request));
Assert.Throws<ArgumentNullException>(() => client.Request("fake", "repo", null));

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

[Fact]
public async Task EnsuresNonEmptyArguments()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservableCheckSuitesClient(gitHubClient);

var request = new CheckSuiteTriggerRequest("123abc");

Assert.Throws<ArgumentException>(() => client.Request("", "repo", request));
Assert.Throws<ArgumentException>(() => client.Request("fake", "", request));
}
}
#pragma warning restore CS0618 // Type or member is obsolete

public class TheRerequestMethod
{
[Fact]
Expand Down

0 comments on commit 9e2f7f2

Please sign in to comment.