예제 #1
0
        public async Task GetBitlinksByGroupSize()
        {
            var bitly = new Bitly(_genericAccessToken);

            Assert.IsNotNull(bitly);
            var firstPage = await bitly.GetBitlinksByGroup(size : 1);

            Assert.IsTrue(firstPage.Links.Any());
            Assert.IsTrue(firstPage.Pagination.Total > firstPage.Pagination.Size);
            var secondPage = await bitly.GetBitlinksByGroup(size : 1, page : 2);

            Assert.AreEqual(2, secondPage.Pagination.Page);
            Assert.AreNotEqual(firstPage.Links.First().Link, secondPage.Links.First().Link);
        }
예제 #2
0
        public async Task GetBitlinksByGroup()
        {
            var bitly = new Bitly(_genericAccessToken);

            Assert.IsNotNull(bitly);
            var firstPage = await bitly.GetBitlinksByGroup();

            Assert.IsTrue(firstPage.Links.Any());
        }
예제 #3
0
        public async Task GetBitlinksByGroupRecent()
        {
            var bitly = new Bitly(_genericAccessToken);

            Assert.IsNotNull(bitly);
            var now          = DateTime.Now;
            var testUrl      = "https://www.google.ca/?q=" + now.ToShortDateString() + now.ToLongTimeString();
            var linkResponse = await bitly.PostShorten(testUrl);

            //Bitly won't show links that are very new
            Thread.Sleep(new TimeSpan(0, 0, 0, 30));
            var newest = await bitly.GetBitlinksByGroup(createdAfter : now);

            Assert.IsTrue(newest.Links.Any(l => l.LongUrl == testUrl));
        }