public async Task EnsureNonNullArguments() { var client = new ObservableCommitsClient(Substitute.For <IGitHubClient>()); var newCommit = new NewCommit("message", "tree", new[] { "parent1", "parent2" }); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create(null, "name", newCommit).ToTask()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create("owner", null, newCommit).ToTask()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Create("owner", "name", null).ToTask()); await Assert.ThrowsAsync <ArgumentException>(() => client.Create("", "name", newCommit).ToTask()); await Assert.ThrowsAsync <ArgumentException>(() => client.Create("owner", "", newCommit).ToTask()); }
public async Task RequestsCorrectUrl() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableCommitsClient(gitHubClient); var newCommit = new NewCommit("message", "tree", new[] { "parent1", "parent2" }); client.Create("owner", "name", newCommit); gitHubClient.Git.Commit.Received().Create("owner", "name", newCommit); }
public async Task PostsToTheCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableCommitsClient(gitHubClient); var newCommit = new NewCommit("message", "tree", new[] { "parent1", "parent2" }); client.Create(1, newCommit); gitHubClient.Git.Commit.Received().Create(1, newCommit); }