public void RequestsCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new CommitStatusClient(connection); client.GetAll("fake", "repo", "sha"); connection.Received() .GetAll <CommitStatus>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/commits/sha/statuses")); }
public void RequestsCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new CommitStatusClient(connection); client.GetAll("fake", "repo", "sha"); connection.Received() .GetAll<CommitStatus>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/commits/sha/statuses")); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For <IApiConnection>(); var client = new CommitStatusClient(connection); await client.GetAll(1, "sha"); connection.Received() .GetAll <CommitStatus>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/commits/sha/statuses"), Args.ApiOptions); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For<IApiConnection>(); var client = new CommitStatusClient(connection); await client.GetAll(1, "sha"); connection.Received() .GetAll<CommitStatus>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/commits/sha/statuses"), Args.ApiOptions); }
public async Task RequestsCorrectUrlWithApiOptions() { var connection = Substitute.For <IApiConnection>(); var client = new CommitStatusClient(connection); var options = new ApiOptions { PageSize = 1, PageCount = 1, StartPage = 1 }; await client.GetAll("fake", "repo", "sha", options); connection.Received() .GetAll <CommitStatus>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/commits/sha/statuses"), options); }
public void RequestsCorrectUrlWithApiOptions() { var connection = Substitute.For<IApiConnection>(); var client = new CommitStatusClient(connection); var options = new ApiOptions { PageSize = 1, PageCount = 1, StartPage = 1 }; client.GetAll("fake", "repo", "sha", options); connection.Received() .GetAll<CommitStatus>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/commits/sha/statuses"), Args.ApiOptions); }
public async Task EnsuresNonNullArguments() { var client = new CommitStatusClient(Substitute.For<IApiConnection>()); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("", "name", "sha")); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("owner", "", "sha")); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("owner", "name", "")); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll(null, "name", "sha")); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll("owner", null, "sha")); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAll("owner", "name", null)); }
public async Task EnsuresNonNullArguments() { var client = new CommitStatusClient(Substitute.For <IApiConnection>()); await Assert.ThrowsAsync <ArgumentException>(() => client.GetAll("", "name", "sha")); await Assert.ThrowsAsync <ArgumentException>(() => client.GetAll("owner", "", "sha")); await Assert.ThrowsAsync <ArgumentException>(() => client.GetAll("owner", "name", "")); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAll(null, "name", "sha")); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAll("owner", null, "sha")); await Assert.ThrowsAsync <ArgumentNullException>(() => client.GetAll("owner", "name", null)); }