public void RequestsCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableCommitStatusClient(gitHubClient); client.GetAll(1, "sha"); gitHubClient.Received().Repository.Status.GetAll(1, "sha"); }
public void EnsuresNonNullArguments() { var client = new ObservableCommitStatusClient(Substitute.For<IGitHubClient>()); Assert.Throws<ArgumentNullException>(() => client.GetAll(null, "name", "sha")); Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", null, "sha")); Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", "name", null)); Assert.Throws<ArgumentNullException>(() => client.GetAll(null, "name", "sha", ApiOptions.None)); Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", null, "sha", ApiOptions.None)); Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", "name", null, ApiOptions.None)); Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", "name", "sha", null)); Assert.Throws<ArgumentNullException>(() => client.GetAll(1, null)); Assert.Throws<ArgumentNullException>(() => client.GetAll(1, "sha", null)); Assert.Throws<ArgumentException>(() => client.GetAll("", "name", "sha")); Assert.Throws<ArgumentException>(() => client.GetAll("owner", "", "sha")); Assert.Throws<ArgumentException>(() => client.GetAll("owner", "name", "")); Assert.Throws<ArgumentException>(() => client.GetAll("", "name", "sha", ApiOptions.None)); Assert.Throws<ArgumentException>(() => client.GetAll("owner", "", "sha", ApiOptions.None)); Assert.Throws<ArgumentException>(() => client.GetAll("owner", "name", "", ApiOptions.None)); Assert.Throws<ArgumentException>(() => client.GetAll(1, "", ApiOptions.None)); }
public void RequestsCorrectUrlWithApiOptionsWithRepositoryId() { var connection = Substitute.For<IGitHubClient>(); var client = new ObservableCommitStatusClient(connection); var options = new ApiOptions { PageSize = 1, PageCount = 1, StartPage = 1 }; client.GetAll(1, "sha", options); connection.Received().Repository.Status.GetAll(1, "sha", options); }