mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-05 19:46:07 +00:00
New unit tests have been added to check ObservableAuthorizationsClient implementation.
This commit is contained in:
@@ -198,6 +198,7 @@
|
||||
<Compile Include="Reactive\Enterprise\ObservableEnterpriseSearchIndexingClientTests.cs" />
|
||||
<Compile Include="Reactive\Enterprise\ObservableEnterpriseOrganizationClientTests.cs" />
|
||||
<Compile Include="Reactive\Enterprise\ObservableEnterpriseLicenseClientTests.cs" />
|
||||
<Compile Include="Reactive\ObservableAuthorizationsClientTests.cs" />
|
||||
<Compile Include="Reactive\ObservableBlobClientTests.cs" />
|
||||
<Compile Include="Reactive\ObservableCommitsClientTests.cs" />
|
||||
<Compile Include="Reactive\ObservableDeploymentsClientTests.cs" />
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NSubstitute;
|
||||
using Octokit.Reactive;
|
||||
using Xunit;
|
||||
|
||||
namespace Octokit.Tests.Reactive
|
||||
{
|
||||
public class ObservableAuthorizationsClientTests
|
||||
{
|
||||
public class TheGetAllMethod
|
||||
{
|
||||
[Fact]
|
||||
public void GetsCorrectUrl()
|
||||
{
|
||||
var client = Substitute.For<IGitHubClient>();
|
||||
var authEndpoint = new ObservableAuthorizationsClient(client);
|
||||
|
||||
authEndpoint.GetAll();
|
||||
|
||||
client.Connection.Received(1).Get<List<Authorization>>(Arg.Is<Uri>(u => u.ToString() == "authorizations"),
|
||||
Arg.Is<Dictionary<string, string>>(dictionary => dictionary.Count == 0), null);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetsCorrectUrlWithApiOption()
|
||||
{
|
||||
var client = Substitute.For<IGitHubClient>();
|
||||
var authEndpoint = new ObservableAuthorizationsClient(client);
|
||||
|
||||
authEndpoint.GetAll(ApiOptions.None);
|
||||
|
||||
client.Connection.Received(1).Get<List<Authorization>>(Arg.Is<Uri>(u => u.ToString() == "authorizations"),
|
||||
Arg.Is<Dictionary<string, string>>(dictionary => dictionary.Count == 0), null);
|
||||
}
|
||||
}
|
||||
|
||||
public class TheCtor
|
||||
{
|
||||
[Fact]
|
||||
public void EnsuresNonNullArguments()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(
|
||||
() => new ObservableAuthorizationsClient(null));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user