public IssuesClient(IApiConnection apiConnection) : base(apiConnection) { Assignee = new AssigneesClient(apiConnection); Events = new IssuesEventsClient(apiConnection); Milestone = new MilestonesClient(apiConnection); Comment = new IssueCommentsClient(apiConnection); }
public async Task EnsuresNonNullArguments() { var client = new MilestonesClient(Substitute.For<IApiConnection>()); await AssertEx.Throws<ArgumentNullException>(async () => await client.Get(null, "name", 1)); await AssertEx.Throws<ArgumentNullException>(async () => await client.Get("owner", null, 1)); await AssertEx.Throws<ArgumentException>(async () => await client.Get(null, "", 1)); await AssertEx.Throws<ArgumentException>(async () => await client.Get("", null, 1)); }
public async Task RequestsCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new MilestonesClient(connection); await client.GetForRepository("fake", "repo"); connection.Received().GetAll<Milestone>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/milestones"), Arg.Any<Dictionary<string, string>>()); }
public void RequestsCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new MilestonesClient(connection); client.Get("fake", "repo", 42); connection.Received().Get<Milestone>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/milestones/42"), null); }
public void PostsToCorrectUrl() { var newMilestone = new NewMilestone("some title"); var connection = Substitute.For<IApiConnection>(); var client = new MilestonesClient(connection); client.Create("fake", "repo", newMilestone); connection.Received().Post<Milestone>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/milestones"), newMilestone); }
public void SendsAppropriateParameters() { var connection = Substitute.For<IApiConnection>(); var client = new MilestonesClient(connection); client.GetForRepository("fake", "repo", new MilestoneRequest { SortDirection = SortDirection.Descending }); connection.Received().GetAll<Milestone>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/milestones"), Arg.Is<Dictionary<string, string>>(d => d.Count == 3 && d["direction"] == "desc" && d["state"] == "open" && d["sort"] == "due_date")); }
public IssuesClient(IApiConnection apiConnection) : base(apiConnection) { Assignee = new AssigneesClient(apiConnection); Milestone = new MilestonesClient(apiConnection); }
public async Task EnsuresArgumentsNotNull() { var connection = Substitute.For<IApiConnection>(); var client = new MilestonesClient(connection); AssertEx.Throws<ArgumentNullException>(async () => await client.Delete(null, "name", 42)); AssertEx.Throws<ArgumentException>(async () => await client.Delete("", "name", 42)); AssertEx.Throws<ArgumentNullException>(async () => await client.Delete("owner", null, 42)); AssertEx.Throws<ArgumentException>(async () => await client.Delete("owner", "", 42)); }
public void PostsToCorrectUrl() { var connection = Substitute.For<IApiConnection>(); var client = new MilestonesClient(connection); client.Delete("fake", "repo", 42); connection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/milestones/42")); }