public async Task EnsureNonNullArguments() { var connection = Substitute.For<IApiConnection>(); var client = new GistsClient(connection); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllCommits(null)); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllCommits("")); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllForks(null)); await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllForks("")); }
public void RequestsCorrectGetCommitsUrl() { var connection = Substitute.For<IApiConnection>(); var client = new GistsClient(connection); client.GetAllCommits("9257657"); connection.Received().GetAll<GistHistory>(Arg.Is<Uri>(u => u.ToString() == "gists/9257657/commits")); }
public void RequestsCorrectGetCommitsUrlWithApiOptions() { var connection = Substitute.For<IApiConnection>(); var client = new GistsClient(connection); var options = new ApiOptions { PageSize = 1, PageCount = 1, StartPage = 1 }; client.GetAllCommits("9257657", options); connection.Received().GetAll<GistHistory>(Arg.Is<Uri>(u => u.ToString() == "gists/9257657/commits"), options); }