Ejemplo n.º 1
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>>());
        }
Ejemplo n.º 2
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"));
        }