public void EnsuresNonEmptyArguments() { var githubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryPagesClient(githubClient); Assert.Throws<ArgumentException>(() => client.GetAll("", "repo", new ApiOptions())); Assert.Throws<ArgumentException>(() => client.GetAll("owner", "", new ApiOptions())); }
public void RequestsCorrectUrl() { var githubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryPagesClient(githubClient); var options = new ApiOptions(); client.GetAll("fake", "repo", options); githubClient.Received().Repository.Page.GetAll("fake", "repo", options); }
public void RequestsCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryPagesClient(gitHubClient); client.GetAll(1); gitHubClient.Received().Repository.Page.GetAll(1); }
public void RequestsCorrectUrlWithApiOptionsWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryPagesClient(gitHubClient); var options = new ApiOptions { PageCount = 1, StartPage = 1, PageSize = 1 }; client.GetAll(1, options); gitHubClient.Received().Repository.Page.GetAll(1, options); }
public void EnsuresNonNullArguments() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryPagesClient(gitHubClient); Assert.Throws<ArgumentNullException>(() => client.GetAll(null, "repo", ApiOptions.None)); Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", null, ApiOptions.None)); Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", "repo", null)); Assert.Throws<ArgumentNullException>(() => client.GetAll(1, null)); Assert.Throws<ArgumentException>(() => client.GetAll("", "repo", ApiOptions.None)); Assert.Throws<ArgumentException>(() => client.GetAll("owner", "", ApiOptions.None)); }