public void CallsIntoClient() { var github = Substitute.For <IGitHubClient>(); var client = new ObservableRepositoriesClient(github); client.GetBranch("owner", "repo", "branch"); github.Repository.Received(1).GetBranch("owner", "repo", "branch"); }
public void RequestsTheCorrectUrlWithRepositoryId() { var github = Substitute.For <IGitHubClient>(); var client = new ObservableRepositoriesClient(github); client.GetBranch(1, "branch"); github.Repository.Branch.Received(1).Get(1, "branch"); }
public async Task EnsuresNonNullArguments() { var client = new ObservableRepositoriesClient(Substitute.For <IGitHubClient>()); Assert.Throws <ArgumentNullException>(() => client.GetBranch(null, "repo", "branch")); Assert.Throws <ArgumentNullException>(() => client.GetBranch("owner", null, "branch")); Assert.Throws <ArgumentNullException>(() => client.GetBranch("owner", "repo", null)); Assert.Throws <ArgumentNullException>(() => client.GetBranch(1, null)); Assert.Throws <ArgumentException>(() => client.GetBranch("", "repo", "branch")); Assert.Throws <ArgumentException>(() => client.GetBranch("owner", "", "branch")); Assert.Throws <ArgumentException>(() => client.GetBranch("owner", "repo", "")); Assert.Throws <ArgumentException>(() => client.GetBranch(1, "")); }
public async Task EnsuresArguments() { var github = Substitute.For <IGitHubClient>(); var nonreactiveClient = new RepositoriesClient(Substitute.For <IApiConnection>()); github.Repository.Returns(nonreactiveClient); var client = new ObservableRepositoriesClient(github); Assert.Throws <ArgumentNullException>(() => client.GetBranch(null, "repo", "branch")); Assert.Throws <ArgumentNullException>(() => client.GetBranch("owner", null, "branch")); Assert.Throws <ArgumentNullException>(() => client.GetBranch("owner", "repo", null)); Assert.Throws <ArgumentException>(() => client.GetBranch("", "repo", "branch")); Assert.Throws <ArgumentException>(() => client.GetBranch("owner", "", "branch")); Assert.Throws <ArgumentException>(() => client.GetBranch("owner", "repo", "")); }