Ejemplo n.º 1
0
    public void CanPageLinks(string url, int pageNumber, bool hasMore, bool expectPrevious, bool expectNext)
    {
        var links = OkWithResourceLinks <string> .GetPagedLinks(new Uri(url), pageNumber, hasMore);

        int expectedLinkCount = 0;

        if (expectPrevious)
        {
            expectedLinkCount++;
        }
        if (expectNext)
        {
            expectedLinkCount++;
        }

        foreach (string link in links)
        {
            _logger.LogInformation(link);
        }

        Assert.Equal(expectedLinkCount, links.Count);
        if (expectPrevious)
        {
            Assert.Contains(links, l => l.Contains("previous"));
        }
        if (expectNext)
        {
            Assert.Contains(links, l => l.Contains("next"));
        }
    }
Ejemplo n.º 2
0
        public void CanPageLinks(string url, int pageNumber, bool hasMore, bool expectPrevious, bool expectNext)
        {
            var links = OkWithResourceLinks <string> .GetPagedLinks(new Uri(url), pageNumber, hasMore);

            int expectedLinkCount = 0;

            if (expectPrevious)
            {
                expectedLinkCount++;
            }
            if (expectNext)
            {
                expectedLinkCount++;
            }

            Assert.Equal(expectedLinkCount, links.Count);
            if (expectPrevious)
            {
                Assert.True(links.Any(l => l.Contains("previous")));
            }
            if (expectNext)
            {
                Assert.True(links.Any(l => l.Contains("next")));
            }

            foreach (var link in links)
            {
                Console.WriteLine(link);
            }
        }