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.GetAllForMilestone(1, 42, options); connection.Received().Get<List<Label>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/milestones/42/labels"), Arg.Is<Dictionary<string, string>>(d => d.Count == 2), null); }
public async Task EnsuresNonNullArguments() { var client = new ObservableIssuesLabelsClient(Substitute.For<IGitHubClient>()); Assert.Throws<ArgumentNullException>(() => client.GetAllForMilestone(null, "name", 42)); Assert.Throws<ArgumentNullException>(() => client.GetAllForMilestone("owner", null, 42)); Assert.Throws<ArgumentNullException>(() => client.GetAllForMilestone(null, "name", 42, ApiOptions.None)); Assert.Throws<ArgumentNullException>(() => client.GetAllForMilestone("owner", null, 42, ApiOptions.None)); Assert.Throws<ArgumentNullException>(() => client.GetAllForMilestone("owner", "name", 42, null)); Assert.Throws<ArgumentNullException>(() => client.GetAllForMilestone(1, 42, null)); Assert.Throws<ArgumentException>(() => client.GetAllForMilestone("", "name", 42)); Assert.Throws<ArgumentException>(() => client.GetAllForMilestone("owner", "", 42)); Assert.Throws<ArgumentException>(() => client.GetAllForMilestone("", "name", 42, ApiOptions.None)); Assert.Throws<ArgumentException>(() => client.GetAllForMilestone("owner", "", 42, ApiOptions.None)); }
public async Task RequestsCorrectUrlWithRepositoryId() { var connection = Substitute.For<IConnection>(); var gitHubClient = new GitHubClient(connection); var client = new ObservableIssuesLabelsClient(gitHubClient); client.GetAllForMilestone(1, 42); connection.Received().Get<List<Label>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/milestones/42/labels"), Args.EmptyDictionary, null); }