From f8c776485636efb77fb48d060fa39ce18efdb679 Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Thu, 17 Mar 2016 15:37:23 +0700 Subject: [PATCH] New unit tests have been added to check ObservableAuthorizationsClient implementation. --- Octokit.Tests/Octokit.Tests.csproj | 1 + .../ObservableAuthorizationsClientTests.cs | 48 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 Octokit.Tests/Reactive/ObservableAuthorizationsClientTests.cs diff --git a/Octokit.Tests/Octokit.Tests.csproj b/Octokit.Tests/Octokit.Tests.csproj index 5c6484c3..cb994ec6 100644 --- a/Octokit.Tests/Octokit.Tests.csproj +++ b/Octokit.Tests/Octokit.Tests.csproj @@ -198,6 +198,7 @@ + diff --git a/Octokit.Tests/Reactive/ObservableAuthorizationsClientTests.cs b/Octokit.Tests/Reactive/ObservableAuthorizationsClientTests.cs new file mode 100644 index 00000000..5aa84daf --- /dev/null +++ b/Octokit.Tests/Reactive/ObservableAuthorizationsClientTests.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(); + var authEndpoint = new ObservableAuthorizationsClient(client); + + authEndpoint.GetAll(); + + client.Connection.Received(1).Get>(Arg.Is(u => u.ToString() == "authorizations"), + Arg.Is>(dictionary => dictionary.Count == 0), null); + } + + [Fact] + public void GetsCorrectUrlWithApiOption() + { + var client = Substitute.For(); + var authEndpoint = new ObservableAuthorizationsClient(client); + + authEndpoint.GetAll(ApiOptions.None); + + client.Connection.Received(1).Get>(Arg.Is(u => u.ToString() == "authorizations"), + Arg.Is>(dictionary => dictionary.Count == 0), null); + } + } + + public class TheCtor + { + [Fact] + public void EnsuresNonNullArguments() + { + Assert.Throws( + () => new ObservableAuthorizationsClient(null)); + } + } + } +}