Files
octokit.net/Octokit.Tests/Reactive/ObservableAuthorizationsClientTests.cs
Ryan Gribble 3c818934b8 Release v0.24 - A Sight For Sore Eyes (#1539)
* Add release notes and bump version to 0.24

* run "build FormatCode" to fix up whitespace/formatting issues

* Fix failing Ssh key tests due to "validation exception".  This key must be in use on github (under another user, most likely from these tests failing).  Changed to a new SSH key and tweaked tests to reduce chance of a key being created and not destroyed

* Assignee and Assignees cant both be specified on NewIssue.  We missed this one in the PR.  Marked Assignee as [Obsolete] and fixed tests to use Assignees

* Fix a couple of Reactions tests that were calling the wrong client methods

* Fix timeline tests - looks like the response class has changed shape a bit, it now has an Issue object in the payload and Id field isnt present (leaving Id field there in case other timeline events do use it)

* Fix some following tests that require the test user to follow more than 1 other user

* Unskip these Event tests now because apparently they work!

* add breaking changes notes

* Update ApiErrorMessageSafe to return null for empty and whitespace strings (#1540)

* return null if ApiError.Message is empty or whitespace

* Uncomment test, which now passes

* update release notes to include PR1540

* Add "Bot" AccountType, was causing a deserialization exception when running the integration test "SearchForExcludedLanguage" (#1541)

* Update to include PR1541

* add bullets to make release notes easier to read

* markup additional code mentions in notes

* Fix grammar

fields => field
2017-01-17 18:56:55 +10:00

60 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Reactive.Threading.Tasks;
using System.Threading.Tasks;
using NSubstitute;
using Octokit.Reactive;
using Xunit;
namespace Octokit.Tests.Reactive
{
public class ObservableAuthorizationsClientTests
{
public class TheGetAllMethod
{
[Fact]
public void RequestsCorrectUrl()
{
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 RequestsCorrectUrlWithApiOption()
{
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);
}
[Fact]
public async Task EnsuresArgumentsNotNull()
{
var client = Substitute.For<IGitHubClient>();
var authEndpoint = new ObservableAuthorizationsClient(client);
await Assert.ThrowsAsync<ArgumentNullException>(() => authEndpoint.GetAll(null).ToTask());
}
}
public class TheCtor
{
[Fact]
public void EnsuresNonNullArguments()
{
Assert.Throws<ArgumentNullException>(
() => new ObservableAuthorizationsClient(null));
}
}
}
}