public async Task RequestsTheCorrectUrlWithRepositoryId() { var connection = Substitute.For <IApiConnection>(); var client = new RepositoryBranchesClient(connection); await client.Get(1, "branch"); connection.Received() .Get <Branch>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/branches/branch"), null, "application/vnd.github.loki-preview+json"); }
public async Task EnsuresNonNullArguments() { var client = new RepositoryBranchesClient(Substitute.For <IApiConnection>()); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Get(null, "repo", "branch")); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Get("owner", null, "branch")); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Get("owner", "repo", null)); await Assert.ThrowsAsync <ArgumentNullException>(() => client.Get(1, null)); await Assert.ThrowsAsync <ArgumentException>(() => client.Get("", "repo", "branch")); await Assert.ThrowsAsync <ArgumentException>(() => client.Get("owner", "", "branch")); await Assert.ThrowsAsync <ArgumentException>(() => client.Get("owner", "repo", "")); }
public async Task EnsuresNonNullArguments() { var client = new RepositoryBranchesClient(Substitute.For<IApiConnection>()); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Get(null, "repo", "branch")); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Get("owner", null, "branch")); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Get("owner", "repo", null)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Get(1, null)); await Assert.ThrowsAsync<ArgumentException>(() => client.Get("", "repo", "branch")); await Assert.ThrowsAsync<ArgumentException>(() => client.Get("owner", "", "branch")); await Assert.ThrowsAsync<ArgumentException>(() => client.Get("owner", "repo", "")); }
public async Task RequestsTheCorrectUrlWithRepositoryId() { var connection = Substitute.For<IApiConnection>(); var client = new RepositoryBranchesClient(connection); await client.Get(1, "branch"); connection.Received() .Get<Branch>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/branches/branch"), null, "application/vnd.github.loki-preview+json"); }