public async Task EnsuresNonNullArguments() { var githubClient = Substitute.For <IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(githubClient); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create(null, "name", "sha", new NewCommitComment("body")).ToTask()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create("owner", null, "sha", new NewCommitComment("body")).ToTask()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create("owner", "name", null, new NewCommitComment("body")).ToTask()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create("owner", "name", "sha", null).ToTask()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create(1, null, new NewCommitComment("body")).ToTask()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create(1, "sha", null).ToTask()); await Assert.ThrowsAsync <ArgumentException>(() => client.Create("", "name", "sha", new NewCommitComment("body")).ToTask()); await Assert.ThrowsAsync <ArgumentException>(() => client.Create("owner", "", "sha", new NewCommitComment("body")).ToTask()); await Assert.ThrowsAsync <ArgumentException>(() => client.Create("owner", "name", "", new NewCommitComment("body")).ToTask()); await Assert.ThrowsAsync <ArgumentException>(() => client.Create(1, "", new NewCommitComment("body")).ToTask()); }
public void PostsToCorrectUrlWithRepositoryId() { var newComment = new NewCommitComment("body"); var githubClient = Substitute.For <IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(githubClient); client.Create(1, "sha", newComment); githubClient.Repository.Comment.Received().Create(1, "sha", newComment); }