public async Task RequestsCorrectUrl() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableCommitsClient(gitHubClient); client.Get("owner", "name", "reference"); gitHubClient.Git.Commit.Received(1).Get("owner", "name", "reference"); }
public async Task RequestsCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableCommitsClient(gitHubClient); client.Get(1, "reference"); gitHubClient.Git.Commit.Received(1).Get(1, "reference"); }
public async Task RequestsCorrectUrl() { var gitHubClient = Substitute.For <IGitHubClient>(); var client = new ObservableCommitsClient(gitHubClient); client.Get("owner", "name", "reference"); gitHubClient.Connection.GetAsync <IReadOnlyList <GitHubClient> >( new Uri("repos/owner/name/commits/reference", UriKind.Relative), null, null); }
public void EnsureNonNullArguments() { var client = new ObservableCommitsClient(Substitute.For <IGitHubClient>()); Assert.Throws <ArgumentNullException>(() => client.Get(null, "name", "")); Assert.Throws <ArgumentNullException>(() => client.Get("owner", null, "")); Assert.Throws <ArgumentNullException>(() => client.Get("owner", "name", null)); Assert.Throws <ArgumentNullException>(() => client.Get(1, null)); Assert.Throws <ArgumentException>(() => client.Get("", "name", "reference")); Assert.Throws <ArgumentException>(() => client.Get("owner", "", "reference")); Assert.Throws <ArgumentException>(() => client.Get("owner", "name", "")); Assert.Throws <ArgumentException>(() => client.Get(1, "")); }
public async Task EnsureNonNullArguments() { var client = new ObservableCommitsClient(Substitute.For <IGitHubClient>()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Get(null, "name", "").ToTask()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Get("owner", null, "").ToTask()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Get("owner", "name", null).ToTask()); await Assert.ThrowsAsync <ArgumentException>(() => client.Get("", "name", "reference").ToTask()); await Assert.ThrowsAsync <ArgumentException>(() => client.Get("owner", "", "reference").ToTask()); await Assert.ThrowsAsync <ArgumentException>(() => client.Get("owner", "name", "").ToTask()); }