本文整理汇总了C#中IssuesClient类的典型用法代码示例。如果您正苦于以下问题:C# IssuesClient类的具体用法?C# IssuesClient怎么用?C# IssuesClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IssuesClient类属于命名空间,在下文中一共展示了IssuesClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnsuresNonNullArguments
public async Task EnsuresNonNullArguments()
{
var client = new IssuesClient(Substitute.For<IApiConnection>());
await AssertEx.Throws<ArgumentNullException>(async () => await client.Get(null, "name", 1));
await AssertEx.Throws<ArgumentNullException>(async () => await client.Get("owner", null, 1));
}
示例2: RequestsCorrectUrl
public void RequestsCorrectUrl()
{
var connection = Substitute.For<IApiConnection>();
var client = new IssuesClient(connection);
client.Get("fake", "repo", 42);
connection.Received().Get<Issue>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42"));
}
示例3: EnsuresNonNullArguments
public async Task EnsuresNonNullArguments()
{
var client = new IssuesClient(Substitute.For<IApiConnection>());
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForOwnedAndMemberRepositories((ApiOptions)null));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForOwnedAndMemberRepositories((IssueRequest)null));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForOwnedAndMemberRepositories(null, new ApiOptions()));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForOwnedAndMemberRepositories(new IssueRequest(), null));
}
示例4: RequestsCorrectUrl
public void RequestsCorrectUrl()
{
var connection = Substitute.For<IApiConnection>();
var client = new IssuesClient(connection);
client.GetAllForOwnedAndMemberRepositories();
connection.Received().GetAll<Issue>(Arg.Is<Uri>(u => u.ToString() == "user/issues"),
Arg.Any<Dictionary<string, string>>());
}
示例5: RequestsCorrectUrlWithRepositoryId
public async Task RequestsCorrectUrlWithRepositoryId()
{
var connection = Substitute.For<IApiConnection>();
var client = new IssuesClient(connection);
await client.Get(1, 42);
connection.Received().Get<Issue>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42"),
Arg.Any<Dictionary<string, string>>(),
"application/vnd.github.squirrel-girl-preview");
}
示例6: RequestsCorrectUrl
public async Task RequestsCorrectUrl()
{
var connection = Substitute.For<IApiConnection>();
var client = new IssuesClient(connection);
await client.GetAllForCurrent();
connection.Received().GetAll<Issue>(Arg.Is<Uri>(u => u.ToString() == "issues"),
Arg.Any<Dictionary<string, string>>(),
"application/vnd.github.squirrel-girl-preview",
Args.ApiOptions);
}
示例7: SendsAppropriateParameters
public void SendsAppropriateParameters()
{
var connection = Substitute.For<IApiConnection>();
var client = new IssuesClient(connection);
client.GetAllForCurrent(new IssueRequest { SortDirection = SortDirection.Ascending });
connection.Received().GetAll<Issue>(Arg.Is<Uri>(u => u.ToString() == "issues"),
Arg.Is<Dictionary<string, string>>(d => d.Count == 4
&& d["filter"] == "assigned"
&& d["sort"] == "created"
&& d["state"] == "open"
&& d["direction"] == "asc"));
}
示例8: SendsAppropriateParameters
public async Task SendsAppropriateParameters()
{
var connection = Substitute.For<IApiConnection>();
var client = new IssuesClient(connection);
await client.GetAllForCurrent(new IssueRequest { SortDirection = SortDirection.Ascending });
connection.Received().GetAll<Issue>(Arg.Is<Uri>(u => u.ToString() == "issues"),
Arg.Is<Dictionary<string, string>>(d => d.Count == 4
&& d["filter"] == "assigned"
&& d["sort"] == "created"
&& d["state"] == "open"
&& d["direction"] == "asc"),
"application/vnd.github.squirrel-girl-preview",
Args.ApiOptions);
}
示例9: PostsToCorrectUrl
public void PostsToCorrectUrl()
{
var connection = Substitute.For<IApiConnection>();
var client = new IssuesClient(connection);
client.Unlock("fake", "repo", 42);
connection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/lock"), Arg.Any<object>(), Arg.Is<string>(u => u.ToString() == "application/vnd.github.the-key-preview+json"));
}
示例10: SendsAppropriateParametersWithRepositoryIdWithApiOptions
public async Task SendsAppropriateParametersWithRepositoryIdWithApiOptions()
{
var connection = Substitute.For<IApiConnection>();
var client = new IssuesClient(connection);
var options = new ApiOptions
{
PageCount = 1,
StartPage = 1,
PageSize = 1
};
await client.GetAllForRepository(1, new RepositoryIssueRequest
{
SortDirection = SortDirection.Ascending
}, options);
connection.Received().GetAll<Issue>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues"),
Arg.Is<Dictionary<string, string>>(d => d.Count == 4
&& d["state"] == "open"
&& d["direction"] == "asc"
&& d["sort"] == "created"
&& d["filter"] == "assigned"),
"application/vnd.github.squirrel-girl-preview",
options);
}
示例11: EnsuresArgumentsNotNull
public async Task EnsuresArgumentsNotNull()
{
var connection = Substitute.For<IApiConnection>();
var client = new IssuesClient(connection);
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Update(null, "name", 1, new IssueUpdate()));
await Assert.ThrowsAsync<ArgumentException>(() => client.Update("", "name", 1, new IssueUpdate()));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Update("owner", null, 1, new IssueUpdate()));
await Assert.ThrowsAsync<ArgumentException>(() => client.Update("owner", "", 1, new IssueUpdate()));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Update("owner", "name", 1, null));
}
示例12: PostsToCorrectUrl
public void PostsToCorrectUrl()
{
var issueUpdate = new IssueUpdate();
var connection = Substitute.For<IApiConnection>();
var client = new IssuesClient(connection);
client.Update("fake", "repo", 42, issueUpdate);
connection.Received().Patch<Issue>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42"),
issueUpdate);
}
示例13: BernieHttpClient
public BernieHttpClient(IssuesClient issuesClient, NewsClient newsClient)
{
_issuesClient = issuesClient;
_newsClient = newsClient;
}
示例14: EnsuresArgumentsNotNull
public void EnsuresArgumentsNotNull()
{
var connection = Substitute.For<IApiConnection>();
var client = new IssuesClient(connection);
Assert.Throws<ArgumentNullException>(() => client.Create(null, "name", new NewIssue("title")));
Assert.Throws<ArgumentException>(() => client.Create("", "name", new NewIssue("x")));
Assert.Throws<ArgumentNullException>(() => client.Create("owner", null, new NewIssue("x")));
Assert.Throws<ArgumentException>(() => client.Create("owner", "", new NewIssue("x")));
Assert.Throws<ArgumentNullException>(() => client.Create("owner", "name", null));
}
示例15: PostsToCorrectUrlWithRepositoryId
public void PostsToCorrectUrlWithRepositoryId()
{
var issueUpdate = new IssueUpdate();
var connection = Substitute.For<IApiConnection>();
var client = new IssuesClient(connection);
client.Update(1, 42, issueUpdate);
connection.Received().Patch<Issue>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42"),
issueUpdate);
}