Пример #1
0
 public IssuesClient(IApiConnection apiConnection) : base(apiConnection)
 {
     Assignee  = new AssigneesClient(apiConnection);
     Events    = new IssuesEventsClient(apiConnection);
     Milestone = new MilestonesClient(apiConnection);
     Comment   = new IssueCommentsClient(apiConnection);
 }
Пример #2
0
 public IssuesClient(IApiConnection apiConnection) : base(apiConnection)
 {
     Assignee = new AssigneesClient(apiConnection);
     Events = new IssuesEventsClient(apiConnection);
     Milestone = new MilestonesClient(apiConnection);
     Comment = new IssueCommentsClient(apiConnection);
 }
Пример #3
0
        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));
        }
Пример #4
0
        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>>());
        }
Пример #5
0
        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);
            }
Пример #7
0
        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"));
        }
Пример #8
0
 public IssuesClient(IApiConnection apiConnection) : base(apiConnection)
 {
     Assignee = new AssigneesClient(apiConnection);
     Milestone = new MilestonesClient(apiConnection);
 }
Пример #9
0
 public IssuesClient(IApiConnection apiConnection) : base(apiConnection)
 {
     Assignee  = new AssigneesClient(apiConnection);
     Milestone = new MilestonesClient(apiConnection);
 }
Пример #10
0
        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));
        }
Пример #11
0
        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"));
        }