public void EnsuresNonNullArguments() { var client = new ObservableCommitStatusClient(Substitute.For<IGitHubClient>()); Assert.Throws<ArgumentNullException>(() => client.Create(null, "name", "sha", new NewCommitStatus())); Assert.Throws<ArgumentNullException>(() => client.Create("owner", null, "sha", new NewCommitStatus())); Assert.Throws<ArgumentNullException>(() => client.Create("owner", "name", null, new NewCommitStatus())); Assert.Throws<ArgumentNullException>(() => client.Create("owner", "name", "sha", null)); Assert.Throws<ArgumentNullException>(() => client.Create(1, null, new NewCommitStatus())); Assert.Throws<ArgumentNullException>(() => client.Create(1, "sha", null)); Assert.Throws<ArgumentException>(() => client.Create("", "name", "sha", new NewCommitStatus())); Assert.Throws<ArgumentException>(() => client.Create("owner", "", "sha", new NewCommitStatus())); Assert.Throws<ArgumentException>(() => client.Create("owner", "name", "", new NewCommitStatus())); Assert.Throws<ArgumentException>(() => client.Create(1, "", new NewCommitStatus())); }
public void PostsToTheCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableCommitStatusClient(gitHubClient); var newCommitStatus = new NewCommitStatus { State = CommitState.Success }; client.Create(1, "sha", newCommitStatus); gitHubClient.Received().Repository.Status.Create(1, "sha", newCommitStatus); }