public async Task EnsuresNonNullArguments() { var client = new ObservableIssuesLabelsClient(Substitute.For <IGitHubClient>()); Assert.Throws <ArgumentNullException>(() => client.GetAllForIssue(null, "name", 1)); Assert.Throws <ArgumentNullException>(() => client.GetAllForIssue("owner", null, 1)); Assert.Throws <ArgumentNullException>(() => client.GetAllForIssue(null, "name", 1, ApiOptions.None)); Assert.Throws <ArgumentNullException>(() => client.GetAllForIssue("owner", null, 1, ApiOptions.None)); Assert.Throws <ArgumentNullException>(() => client.GetAllForIssue("owner", "name", 1, null)); Assert.Throws <ArgumentNullException>(() => client.GetAllForIssue(1, 1, null)); Assert.Throws <ArgumentException>(() => client.GetAllForIssue("", "name", 1)); Assert.Throws <ArgumentException>(() => client.GetAllForIssue("owner", "", 1)); Assert.Throws <ArgumentException>(() => client.GetAllForIssue("", "name", 1, ApiOptions.None)); Assert.Throws <ArgumentException>(() => client.GetAllForIssue("owner", "", 1, ApiOptions.None)); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableIssuesLabelsClient(gitHubClient); client.GetAllForIssue(1, 42); connection.Received().Get <List <Label> >(Arg.Is <Uri>(u => u.ToString() == "repositories/1/issues/42/labels"), Args.EmptyDictionary, null); }
public async Task RequestsCorrectUrl() { var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableIssuesLabelsClient(gitHubClient); client.GetAllForIssue("fake", "repo", 42); connection.Received().Get <List <Label> >(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/issues/42/labels"), Args.EmptyDictionary, "application/vnd.github.symmetra-preview+json"); }
public async Task RequestsCorrectUrlWithApiOptionsWithRepositoryId() { var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableIssuesLabelsClient(gitHubClient); var options = new ApiOptions { PageCount = 1, StartPage = 1, PageSize = 1 }; client.GetAllForIssue(1, 42, options); connection.Received().Get <List <Label> >(Arg.Is <Uri>(u => u.ToString() == "repositories/1/issues/42/labels"), Arg.Is <Dictionary <string, string> >(d => d.Count == 2), null); }
public async Task RequestsCorrectUrlWithApiOptions() { var connection = Substitute.For <IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableIssuesLabelsClient(gitHubClient); var options = new ApiOptions { PageCount = 1, StartPage = 1, PageSize = 1 }; client.GetAllForIssue("fake", "repo", 42, options); connection.Received().Get <List <Label> >(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/issues/42/labels"), Arg.Is <Dictionary <string, string> >(d => d.Count == 2), "application/vnd.github.symmetra-preview+json"); }