mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-05 03:30:34 +00:00
SshKeys, Statistics, Tags, Teams, Trees, Users
This commit is contained in:
@@ -85,7 +85,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task EnsuresArgumentsNotNull()
|
||||
{
|
||||
var userEndpoint = new SshKeysClient(Substitute.For<IApiConnection>());
|
||||
await AssertEx.Throws<ArgumentNullException>(() => userEndpoint.Update(1, null));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => userEndpoint.Update(1, null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task EnsuresArgumentsNotNull()
|
||||
{
|
||||
var userEndpoint = new SshKeysClient(Substitute.For<IApiConnection>());
|
||||
await AssertEx.Throws<ArgumentNullException>(() => userEndpoint.Create(null));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => userEndpoint.Create(null));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,14 +37,14 @@ namespace Octokit.Tests.Clients
|
||||
public async Task ThrowsIfGivenNullOwner()
|
||||
{
|
||||
var statisticsClient = new StatisticsClient(Substitute.For<IApiConnection>());
|
||||
await AssertEx.Throws<ArgumentNullException>(() => statisticsClient.GetContributors(null,"repositoryName"));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => statisticsClient.GetContributors(null,"repositoryName"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ThrowsIfGivenNullRepositoryName()
|
||||
{
|
||||
var statisticsClient = new StatisticsClient(Substitute.For<IApiConnection>());
|
||||
await AssertEx.Throws<ArgumentNullException>(() => statisticsClient.GetContributors("owner", null));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => statisticsClient.GetContributors("owner", null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,14 +67,14 @@ namespace Octokit.Tests.Clients
|
||||
public async Task ThrowsIfGivenNullOwner()
|
||||
{
|
||||
var statisticsClient = new StatisticsClient(Substitute.For<IApiConnection>());
|
||||
await AssertEx.Throws<ArgumentNullException>(() => statisticsClient.GetCommitActivity(null, "repositoryName"));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => statisticsClient.GetCommitActivity(null, "repositoryName"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ThrowsIfGivenNullRepositoryName()
|
||||
{
|
||||
var statisticsClient = new StatisticsClient(Substitute.For<IApiConnection>());
|
||||
await AssertEx.Throws<ArgumentNullException>(() => statisticsClient.GetCommitActivity("owner", null));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => statisticsClient.GetCommitActivity("owner", null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,14 +97,14 @@ namespace Octokit.Tests.Clients
|
||||
public async Task ThrowsIfGivenNullOwner()
|
||||
{
|
||||
var statisticsClient = new StatisticsClient(Substitute.For<IApiConnection>());
|
||||
await AssertEx.Throws<ArgumentNullException>(() => statisticsClient.GetCodeFrequency(null, "repositoryName"));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => statisticsClient.GetCodeFrequency(null, "repositoryName"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ThrowsIfGivenNullRepositoryName()
|
||||
{
|
||||
var statisticsClient = new StatisticsClient(Substitute.For<IApiConnection>());
|
||||
await AssertEx.Throws<ArgumentNullException>(() => statisticsClient.GetCodeFrequency("owner", null));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => statisticsClient.GetCodeFrequency("owner", null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,14 +127,14 @@ namespace Octokit.Tests.Clients
|
||||
public async Task ThrowsIfGivenNullOwner()
|
||||
{
|
||||
var statisticsClient = new StatisticsClient(Substitute.For<IApiConnection>());
|
||||
await AssertEx.Throws<ArgumentNullException>(() => statisticsClient.GetParticipation(null, "repositoryName"));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => statisticsClient.GetParticipation(null, "repositoryName"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ThrowsIfGivenNullRepositoryName()
|
||||
{
|
||||
var statisticsClient = new StatisticsClient(Substitute.For<IApiConnection>());
|
||||
await AssertEx.Throws<ArgumentNullException>(() => statisticsClient.GetParticipation("owner", null));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => statisticsClient.GetParticipation("owner", null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,14 +157,14 @@ namespace Octokit.Tests.Clients
|
||||
public async Task ThrowsIfGivenNullOwner()
|
||||
{
|
||||
var statisticsClient = new StatisticsClient(Substitute.For<IApiConnection>());
|
||||
await AssertEx.Throws<ArgumentNullException>(() => statisticsClient.GetPunchCard(null, "repositoryName"));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => statisticsClient.GetPunchCard(null, "repositoryName"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ThrowsIfGivenNullRepositoryName()
|
||||
{
|
||||
var statisticsClient = new StatisticsClient(Substitute.For<IApiConnection>());
|
||||
await AssertEx.Throws<ArgumentNullException>(() => statisticsClient.GetPunchCard("owner", null));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => statisticsClient.GetPunchCard("owner", null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,12 @@ public class TagsClientTests
|
||||
{
|
||||
var client = new TagsClient(Substitute.For<IApiConnection>());
|
||||
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Get(null, "name", "reference"));
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Get("owner", null, "reference"));
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Get("owner", "name", null));
|
||||
await AssertEx.Throws<ArgumentException>(async () => await client.Get("", "name", "reference"));
|
||||
await AssertEx.Throws<ArgumentException>(async () => await client.Get("owner", "", "reference"));
|
||||
await AssertEx.Throws<ArgumentException>(async () => await client.Get("owner", "name", ""));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Get(null, "name", "reference"));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Get("owner", null, "reference"));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Get("owner", "name", null));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.Get("", "name", "reference"));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.Get("owner", "", "reference"));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.Get("owner", "name", ""));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,11 +55,11 @@ public class TagsClientTests
|
||||
{
|
||||
var client = new TagsClient(Substitute.For<IApiConnection>());
|
||||
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Create(null, "name", new NewTag()));
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Create("owner", null, new NewTag()));
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Create("owner", "name", null));
|
||||
await AssertEx.Throws<ArgumentException>(async () => await client.Create("", "name", new NewTag()));
|
||||
await AssertEx.Throws<ArgumentException>(async () => await client.Create("owner", "", new NewTag()));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create(null, "name", new NewTag()));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create("owner", null, new NewTag()));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create("owner", "name", null));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.Create("", "name", new NewTag()));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.Create("owner", "", new NewTag()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace Octokit.Tests.Clients
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new TeamsClient(connection);
|
||||
|
||||
AssertEx.Throws<ArgumentNullException>(() => client.IsMember(1, null));
|
||||
Assert.ThrowsAsync<ArgumentNullException>(() => client.IsMember(1, null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -138,7 +138,7 @@ namespace Octokit.Tests.Clients
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new TeamsClient(connection);
|
||||
|
||||
AssertEx.Throws<ArgumentException>(() => client.IsMember(1, ""));
|
||||
Assert.ThrowsAsync<ArgumentException>(() => client.IsMember(1, ""));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace Octokit.Tests.Clients
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new TeamsClient(connection);
|
||||
|
||||
AssertEx.Throws<ArgumentException>(() => client.AddRepository(1, null, "Repo Name"));
|
||||
Assert.ThrowsAsync<ArgumentException>(() => client.AddRepository(1, null, "Repo Name"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -222,7 +222,7 @@ namespace Octokit.Tests.Clients
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new TeamsClient(connection);
|
||||
|
||||
AssertEx.Throws<ArgumentException>(() => client.AddRepository(1, "org name", null));
|
||||
Assert.ThrowsAsync<ArgumentException>(() => client.AddRepository(1, "org name", null));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,12 +30,12 @@ namespace Octokit.Tests
|
||||
{
|
||||
var client = new TreesClient(Substitute.For<IApiConnection>());
|
||||
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Get(null, "name", "123456ABCD"));
|
||||
await AssertEx.Throws<ArgumentException>(async () => await client.Get("", "name", "123456ABCD"));
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Get("owner", null, "123456ABCD"));
|
||||
await AssertEx.Throws<ArgumentException>(async () => await client.Get("owner", "", "123456ABCD"));
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Get("owner", "name", null));
|
||||
await AssertEx.Throws<ArgumentException>(async () => await client.Get("owner", "name", ""));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Get(null, "name", "123456ABCD"));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.Get("", "name", "123456ABCD"));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Get("owner", null, "123456ABCD"));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.Get("owner", "", "123456ABCD"));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Get("owner", "name", null));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.Get("owner", "name", ""));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,12 +58,12 @@ namespace Octokit.Tests
|
||||
{
|
||||
var client = new TreesClient(Substitute.For<IApiConnection>());
|
||||
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.GetRecursive(null, "name", "123456ABCD"));
|
||||
await AssertEx.Throws<ArgumentException>(async () => await client.GetRecursive("", "name", "123456ABCD"));
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.GetRecursive("owner", null, "123456ABCD"));
|
||||
await AssertEx.Throws<ArgumentException>(async () => await client.GetRecursive("owner", "", "123456ABCD"));
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.GetRecursive("owner", "name", null));
|
||||
await AssertEx.Throws<ArgumentException>(async () => await client.GetRecursive("owner", "name", ""));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetRecursive(null, "name", "123456ABCD"));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.GetRecursive("", "name", "123456ABCD"));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetRecursive("owner", null, "123456ABCD"));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.GetRecursive("owner", "", "123456ABCD"));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetRecursive("owner", "name", null));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.GetRecursive("owner", "name", ""));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,10 +87,10 @@ namespace Octokit.Tests
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new TreesClient(connection);
|
||||
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Create(null, "name", new NewTree()));
|
||||
await AssertEx.Throws<ArgumentException>(async () => await client.Create("", "name", new NewTree()));
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Create("owner", null, new NewTree()));
|
||||
await AssertEx.Throws<ArgumentException>(async () => await client.Create("owner", "", new NewTree()));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create(null, "name", new NewTree()));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.Create("", "name", new NewTree()));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Create("owner", null, new NewTree()));
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => client.Create("owner", "", new NewTree()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -102,8 +102,8 @@ namespace Octokit.Tests
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new TreesClient(connection);
|
||||
|
||||
await AssertEx.Throws<ArgumentException>(
|
||||
async () => await client.Create("fake", "repo", newTree));
|
||||
await Assert.ThrowsAsync<ArgumentException>(
|
||||
() => client.Create("fake", "repo", newTree));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task ThrowsIfGivenNullUser()
|
||||
{
|
||||
var userEndpoint = new UsersClient(Substitute.For<IApiConnection>());
|
||||
await AssertEx.Throws<ArgumentNullException>(() => userEndpoint.Get(null));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => userEndpoint.Get(null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task ThrowsIfGivenNullUser()
|
||||
{
|
||||
var userEndpoint = new UsersClient(Substitute.For<IApiConnection>());
|
||||
await AssertEx.Throws<ArgumentNullException>(() => userEndpoint.Get(null));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => userEndpoint.Get(null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task EnsuresArgumentsNotNull()
|
||||
{
|
||||
var userEndpoint = new UsersClient(Substitute.For<IApiConnection>());
|
||||
await AssertEx.Throws<ArgumentNullException>(() => userEndpoint.Update(null));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => userEndpoint.Update(null));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user