public void EnsuresNonNullArguments() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableGitHubAppsClient(gitHubClient); Assert.Throws <ArgumentNullException>(() => client.GetAllInstallationsForCurrent(null)); }
public void RequestsCorrectUrl() { var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableGitHubAppsClient(gitHubClient); client.GetAllInstallationsForCurrent(); connection.Received().Get <List <Installation> >( Arg.Is <Uri>(u => u.ToString() == "app/installations"), Args.EmptyDictionary, "application/vnd.github.machine-man-preview+json"); }
public void RequestsTheCorrectUrlWithApiOptions() { var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableGitHubAppsClient(gitHubClient); var options = new ApiOptions { PageSize = 1 }; client.GetAllInstallationsForCurrent(options); connection.Received().Get <List <Installation> >( Arg.Is <Uri>(u => u.ToString() == "app/installations"), Arg.Is <Dictionary <string, string> >(x => x.Count == 1 && x["per_page"] == "1"), "application/vnd.github.machine-man-preview+json"); }