mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-05-31 02:05:39 +00:00
Add 'correct url' tests for issue events client
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NSubstitute;
|
||||
using Octokit.Tests.Helpers;
|
||||
using Xunit;
|
||||
|
||||
namespace Octokit.Tests.Clients
|
||||
{
|
||||
public class IssuesEventsClientTests
|
||||
{
|
||||
public class TheGetForIssueMethod
|
||||
{
|
||||
[Fact]
|
||||
public async Task RequestsCorrectUrl()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new IssuesEventsClient(connection);
|
||||
|
||||
await client.GetForIssue("fake", "repo", 42);
|
||||
|
||||
connection.Received().GetAll<EventInfo>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/events"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EnsuresNonNullArguments()
|
||||
{
|
||||
var client = new IssuesEventsClient(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));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheGetForRepositoryMethod
|
||||
{
|
||||
[Fact]
|
||||
public async Task RequestsCorrectUrl()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new IssuesEventsClient(connection);
|
||||
|
||||
await client.GetForRepository("fake", "repo");
|
||||
|
||||
connection.Received().GetAll<IssueEvent>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/events"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EnsuresNonNullArguments()
|
||||
{
|
||||
var client = new IssuesEventsClient(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));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheGetMethod
|
||||
{
|
||||
[Fact]
|
||||
public void RequestsCorrectUrl()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new IssuesEventsClient(connection);
|
||||
|
||||
client.Get("fake", "repo", 42);
|
||||
|
||||
connection.Received().Get<IssueEvent>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/events/42"),
|
||||
null);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EnsuresNonNullArguments()
|
||||
{
|
||||
var client = new IssuesEventsClient(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));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,7 @@
|
||||
<Compile Include="Clients\AssigneesClientTests.cs" />
|
||||
<Compile Include="Clients\CommitStatusClientTests.cs" />
|
||||
<Compile Include="Clients\IssuesClientTests.cs" />
|
||||
<Compile Include="Clients\IssuesEventsClientTests.cs" />
|
||||
<Compile Include="Clients\MilestonesClientTests.cs" />
|
||||
<Compile Include="Clients\MiscellaneousClientTests.cs" />
|
||||
<Compile Include="Clients\NotificationsClientTests.cs" />
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
<Compile Include="Authentication\CredentialsTests.cs" />
|
||||
<Compile Include="Clients\AssigneesClientTests.cs" />
|
||||
<Compile Include="Clients\CommitStatusClientTests.cs" />
|
||||
<Compile Include="Clients\IssuesEventsClientTests.cs" />
|
||||
<Compile Include="Clients\MilestonesClientTests.cs" />
|
||||
<Compile Include="Clients\IssuesClientTests.cs" />
|
||||
<Compile Include="Clients\NotificationsClientTests.cs" />
|
||||
|
||||
Reference in New Issue
Block a user