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); var update = new RepositoryUpdate(); Assert.Throws <ArgumentNullException>(() => client.Edit(null, "repo", update)); Assert.Throws <ArgumentNullException>(() => client.Edit("owner", null, update)); Assert.Throws <ArgumentNullException>(() => client.Edit("owner", "repo", null)); Assert.Throws <ArgumentException>(() => client.Edit("", "repo", update)); Assert.Throws <ArgumentException>(() => client.Edit("owner", "", update)); }
public void CallsIntoClient() { var github = Substitute.For <IGitHubClient>(); var client = new ObservableRepositoriesClient(github); var update = new RepositoryUpdate(); client.Edit("owner", "repo", update); github.Repository.Received(1).Edit("owner", "repo", update); }
public void PatchsTheCorrectUrlWithRepositoryId() { var github = Substitute.For <IGitHubClient>(); var client = new ObservableRepositoriesClient(github); var update = new RepositoryUpdate(); client.Edit(1, update); github.Repository.Received(1).Edit(1, update); }
public void PatchsTheCorrectUrl() { var github = Substitute.For <IGitHubClient>(); var client = new ObservableRepositoriesClient(github); var update = new RepositoryUpdate("anyreponame"); client.Edit("owner", "repo", update); github.Repository.Received(1).Edit("owner", "repo", update); }
public async Task EnsuresNonNullArguments() { var client = new ObservableRepositoriesClient(Substitute.For <IGitHubClient>()); var update = new RepositoryUpdate(); Assert.Throws <ArgumentNullException>(() => client.Edit(null, "repo", update)); Assert.Throws <ArgumentNullException>(() => client.Edit("owner", null, update)); Assert.Throws <ArgumentNullException>(() => client.Edit("owner", "repo", null)); Assert.Throws <ArgumentNullException>(() => client.Edit(1, null)); Assert.Throws <ArgumentException>(() => client.Edit("", "repo", update)); Assert.Throws <ArgumentException>(() => client.Edit("owner", "", update)); }