mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-07 04:16:51 +00:00
added unit tests
This commit is contained in:
@@ -27,6 +27,10 @@ namespace Octokit.Tests.Reactive
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() => _client.GetAll(null, "repo", 1));
|
||||
Assert.Throws<ArgumentNullException>(() => _client.GetAll("owner", null, 1));
|
||||
|
||||
Assert.Throws<ArgumentNullException>(() => _client.GetAll(null, "repo", 1, ApiOptions.None));
|
||||
Assert.Throws<ArgumentNullException>(() => _client.GetAll("owner", null, 1, ApiOptions.None));
|
||||
Assert.Throws<ArgumentNullException>(() => _client.GetAll("owner", "repo", 1, null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -34,6 +38,9 @@ namespace Octokit.Tests.Reactive
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => _client.GetAll("", "repo", 1));
|
||||
Assert.Throws<ArgumentException>(() => _client.GetAll("owner", "", 1));
|
||||
|
||||
Assert.Throws<ArgumentException>(() => _client.GetAll("", "repo", 1, ApiOptions.None));
|
||||
Assert.Throws<ArgumentException>(() => _client.GetAll("owner", "", 1, ApiOptions.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -43,10 +50,15 @@ namespace Octokit.Tests.Reactive
|
||||
async whitespace => await _client.GetAll(whitespace, "repo", 1));
|
||||
await AssertEx.ThrowsWhenGivenWhitespaceArgument(
|
||||
async whitespace => await _client.GetAll("owner", whitespace, 1));
|
||||
|
||||
await AssertEx.ThrowsWhenGivenWhitespaceArgument(
|
||||
async whitespace => await _client.GetAll(whitespace, "repo", 1, ApiOptions.None));
|
||||
await AssertEx.ThrowsWhenGivenWhitespaceArgument(
|
||||
async whitespace => await _client.GetAll("owner", whitespace, 1, ApiOptions.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetsFromCorrectUrl()
|
||||
public void RequestsCorrectUrl()
|
||||
{
|
||||
var expectedUri = ApiUrls.DeploymentStatuses("owner", "repo", 1);
|
||||
|
||||
@@ -54,8 +66,28 @@ namespace Octokit.Tests.Reactive
|
||||
|
||||
_githubClient.Connection.Received(1)
|
||||
.Get<List<DeploymentStatus>>(Arg.Is(expectedUri),
|
||||
Arg.Any<IDictionary<string, string>>(),
|
||||
Arg.Any<string>());
|
||||
Args.EmptyDictionary,
|
||||
null);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RequestsCorrectUrlWitApiOptions()
|
||||
{
|
||||
var expectedUri = ApiUrls.DeploymentStatuses("owner", "repo", 1);
|
||||
|
||||
var options = new ApiOptions
|
||||
{
|
||||
StartPage = 1,
|
||||
PageCount = 1,
|
||||
PageSize = 1
|
||||
};
|
||||
|
||||
_client.GetAll("owner", "repo", 1, options);
|
||||
|
||||
_githubClient.Connection.Received(1)
|
||||
.Get<List<DeploymentStatus>>(Arg.Is(expectedUri),
|
||||
Arg.Is<Dictionary<string, string>>(dictionary => dictionary.Count == 2),
|
||||
null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user