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 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 RequestsTheCorrectUrlWithSinceAndApiOptions() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableGistsClient(gitHubClient); var options = new ApiOptions { PageCount = 1, PageSize = 1, StartPage = 1 }; var since = DateTimeOffset.Now; client.GetAllPublic(since, options); gitHubClient.Connection.Received(1).Get<List<Gist>>(Arg.Is<Uri>(u => u.ToString() == "gists/public"), DictionaryWithApiOptionsAndSince, 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); }