mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-07 04:16:51 +00:00
Added unit tests for Reactive functions
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using NSubstitute;
|
||||
using Octokit.Reactive;
|
||||
using Xunit;
|
||||
|
||||
namespace Octokit.Tests.Reactive
|
||||
{
|
||||
public class ObservableRepositoryPagesClientTests
|
||||
{
|
||||
public class TheGetAllMethod
|
||||
{
|
||||
[Fact]
|
||||
public void RequestsCorrectUrl()
|
||||
{
|
||||
var githubClient = Substitute.For<IGitHubClient>();
|
||||
var client = new ObservableRepositoryPagesClient(githubClient);
|
||||
var options = new ApiOptions();
|
||||
|
||||
client.GetAll("fake", "repo", options);
|
||||
|
||||
githubClient.Repository.Page.Received().GetAll("fake", "repo", options);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EnsuresNonNullArguments()
|
||||
{
|
||||
var githubClient = Substitute.For<IGitHubClient>();
|
||||
var client = new ObservableRepositoryPagesClient(githubClient);
|
||||
var options = new ApiOptions();
|
||||
|
||||
Assert.Throws<ArgumentNullException>(() => client.GetAll(null, "repo", new ApiOptions()));
|
||||
Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", null, new ApiOptions()));
|
||||
Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", "repo", null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EnsuresNonEmptyArguments()
|
||||
{
|
||||
var githubClient = Substitute.For<IGitHubClient>();
|
||||
var client = new ObservableRepositoryPagesClient(githubClient);
|
||||
var options = new ApiOptions();
|
||||
|
||||
Assert.Throws<ArgumentException>(() => client.GetAll("", "repo", new ApiOptions()));
|
||||
Assert.Throws<ArgumentException>(() => client.GetAll("owner", "", new ApiOptions()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user