public void RequestsCorrectUrl() { var connection = Substitute.For <IConnection>(); var gitHubClient = Substitute.For <IGitHubClient>(); gitHubClient.Connection.Returns(connection); var client = new ObservableWatchedClient(gitHubClient); client.GetAllForCurrent(); connection.Received().Get <List <Repository> >(ApiUrls.Watched(), Args.EmptyDictionary, null); }
public void RequestsCorrectUrlWithApiOptions() { var connection = Substitute.For <IConnection>(); var gitHubClient = Substitute.For <IGitHubClient>(); gitHubClient.Connection.Returns(connection); var client = new ObservableWatchedClient(gitHubClient); var options = new ApiOptions { StartPage = 1, PageCount = 1, PageSize = 1 }; client.GetAllForCurrent(options); connection.Received().Get <List <Repository> >(ApiUrls.Watched(), Arg.Is <IDictionary <string, string> >(d => d.Count == 2), null); }
public void EnsuresNonNullArguments() { var client = new ObservableWatchedClient(Substitute.For <IGitHubClient>()); Assert.Throws <ArgumentNullException>(() => client.GetAllForCurrent(null)); }