Add ApiOptions overloads to methods on I(Observable)RepositoryDeployKeysClient (#1307)

This commit is contained in:
Alexander Efremov
2016-05-20 18:45:34 +07:00
committed by Brendan Forster
parent 289cae568b
commit c4520123bf
7 changed files with 264 additions and 6 deletions

View File

@@ -55,7 +55,27 @@ namespace Octokit.Tests.Clients
deployKeysClient.GetAll("user", "repo");
apiConnection.Received().GetAll<DeployKey>(Arg.Is<Uri>(u => u.ToString() == "repos/user/repo/keys"));
apiConnection.Received().GetAll<DeployKey>(Arg.Is<Uri>(u => u.ToString() == "repos/user/repo/keys"), Args.ApiOptions);
}
[Fact]
public void GetsAListOfDeployKeysWithApiOptions()
{
var connection = Substitute.For<IApiConnection>();
var client = new RepositoryDeployKeysClient(connection);
var options = new ApiOptions
{
PageCount = 1,
PageSize = 1,
StartPage = 1
};
client.GetAll("user", "repo", options);
connection.Received(1)
.GetAll<DeployKey>(Arg.Is<Uri>(u => u.ToString() == "repos/user/repo/keys"),
options);
}
[Fact]
@@ -63,10 +83,22 @@ namespace Octokit.Tests.Clients
{
var deployKeysClient = new RepositoryDeployKeysClient(Substitute.For<IApiConnection>());
await Assert.ThrowsAsync<ArgumentNullException>(() => deployKeysClient.GetAll(null, null));
await Assert.ThrowsAsync<ArgumentNullException>(() => deployKeysClient.GetAll(null, "repo"));
await Assert.ThrowsAsync<ArgumentException>(() => deployKeysClient.GetAll("", "repo"));
await Assert.ThrowsAsync<ArgumentNullException>(() => deployKeysClient.GetAll("user", null));
await Assert.ThrowsAsync<ArgumentNullException>(() => deployKeysClient.GetAll(null, null, null));
await Assert.ThrowsAsync<ArgumentNullException>(() => deployKeysClient.GetAll(null, null, ApiOptions.None));
await Assert.ThrowsAsync<ArgumentNullException>(() => deployKeysClient.GetAll(null, "repo", null));
await Assert.ThrowsAsync<ArgumentNullException>(() => deployKeysClient.GetAll("user", null, null));
await Assert.ThrowsAsync<ArgumentNullException>(() => deployKeysClient.GetAll(null, "repo", ApiOptions.None));
await Assert.ThrowsAsync<ArgumentNullException>(() => deployKeysClient.GetAll("user", null, ApiOptions.None));
await Assert.ThrowsAsync<ArgumentNullException>(() => deployKeysClient.GetAll("user", "repo", null));
await Assert.ThrowsAsync<ArgumentException>(() => deployKeysClient.GetAll("user", ""));
await Assert.ThrowsAsync<ArgumentException>(() => deployKeysClient.GetAll("", "repo"));
}
}