mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-22 07:05:12 +00:00
* Added ApiOptions overloads for RepositoryCommitClient methods * Added overloads to Reactive clients * Integration tests in progress * Integration test addition in progress * More integration tests added * Added Ensure things * Minor changes * Minor changes * Few changes * Tried to fix errors * Tried to fix errors * Fixed a few things * Fixed integration tests * Tidying up * Added public keyword * Added unit tests for GetAll() in normal and reactive methods * Minor changes * Changed the class name * Fixed the unit test
51 lines
2.0 KiB
C#
51 lines
2.0 KiB
C#
using NSubstitute;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Xunit;
|
|
|
|
namespace Octokit.Tests.Clients
|
|
{
|
|
public class RespositoryCommitsClientTests
|
|
{
|
|
public class TheGetAllMethod
|
|
{
|
|
[Fact]
|
|
public void EnsuresNonEmptyArguments()
|
|
{
|
|
var connection = Substitute.For<IApiConnection>();
|
|
var client = new RepositoryCommitsClient(connection);
|
|
var options = new ApiOptions();
|
|
var request = new CommitRequest();
|
|
|
|
Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("", "name", request, options));
|
|
Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("owner", "", request, options));
|
|
}
|
|
|
|
[Fact]
|
|
public void EnsuresNonNullArguments()
|
|
{
|
|
var connection = Substitute.For<IApiConnection>();
|
|
var client = new RepositoryCommitsClient(connection);
|
|
var options = new ApiOptions();
|
|
var request = new CommitRequest();
|
|
|
|
Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll(null, "name", request, options));
|
|
Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll("owner", null, request, options));
|
|
Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll("owner", "name", null, options));
|
|
Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll("owner", "name", request, null));
|
|
|
|
}
|
|
|
|
[Fact]
|
|
public void GetsCorrectUrl()
|
|
{
|
|
var connection = Substitute.For<IApiConnection>();
|
|
var client = new RepositoryCommitsClient(connection);
|
|
|
|
client.GetAll("fake", "repo", new CommitRequest(), new ApiOptions());
|
|
connection.Received().GetAll<GitHubCommit>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/commits"), Args.EmptyDictionary, Args.ApiOptions);
|
|
}
|
|
}
|
|
}
|
|
}
|