public void EnsuresNonNullArguments() { var gitsClient = new ObservableGistsClient(Substitute.For <IGitHubClient>()); Assert.Throws <ArgumentNullException>(() => gitsClient.GetAllPublic(null)); Assert.Throws <ArgumentNullException>(() => gitsClient.GetAllPublic(DateTimeOffset.Now, null)); }
public void RequestsTheCorrectUrl() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableGistsClient(gitHubClient); client.GetAllPublic(); gitHubClient.Connection.Received(1).Get <List <Gist> >(Arg.Is <Uri>(u => u.ToString() == "gists/public"), Args.EmptyDictionary, null); }
public void RequestsTheCorrectUrlWithSince() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableGistsClient(gitHubClient); var since = DateTimeOffset.Now; client.GetAllPublic(since); gitHubClient.Connection.Received(1).Get <List <Gist> >(Arg.Is <Uri>(u => u.ToString() == "gists/public"), DictionaryWithSince, null); }
public void RequestsTheCorrectUrlWithApiOptions() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableGistsClient(gitHubClient); var options = new ApiOptions { PageSize = 1, PageCount = 1, StartPage = 1 }; client.GetAllPublic(options); gitHubClient.Connection.Received(1).Get <List <Gist> >(Arg.Is <Uri>(u => u.ToString() == "gists/public"), DictionaryWithApiOptions, null); }
public async Task ReturnsPublicGists() { var gists = await _gistsClient.GetAllPublic().ToList(); Assert.NotEmpty(gists); }