public async Task TestNoPagesReturned()
        {
            var emptyResponse = new PageListFB
            {
                Data = new PageFB[] { }
            };

            var restApiRepositoryMock = new Mock <IRestApiRepository>();

            restApiRepositoryMock.Setup(x => x.GetRequestAsync <PageListFB>(It.IsAny <string>(), null,
                                                                            It.IsAny <Dictionary <string, string> >(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(emptyResponse);
            var facebookProvider = new FacebookProvider(new AzureTableProvider(Settings.StorageAccountConnectionString))
            {
                Client = restApiRepositoryMock.Object
            };
            var queryParams = new Dictionary <string, string> {
                { "access_token", "any" }, { "fields", "id,name" }
            };
            var allPages = await facebookProvider.GatherAllPages(queryParams);

            Assert.AreEqual(0, allPages.Count);
        }
        public async Task TestGatherAllPages()
        {
            var responsePart1 = new PageListFB
            {
                Data = new[]
                {
                    new PageFB
                    {
                        Id   = "1",
                        Name = "p1"
                    }
                },
                Paging = new PagingFB
                {
                    Cursors = new CursorsFB
                    {
                        Before = "NA",
                        After  = "first"
                    },
                    Next = "RANDOM"
                }
            };

            var responseLastPart = new PageListFB
            {
                Data = new[]
                {
                    new PageFB
                    {
                        Id   = "2",
                        Name = "p2"
                    }
                },
                Paging = new PagingFB
                {
                    Cursors = new CursorsFB
                    {
                        Before = "NA",
                        After  = "first"
                    },
                    Next = null
                }
            };
            var restApiRepositoryMock = new Mock <IRestApiRepository>();

            restApiRepositoryMock.SetupSequence(x => x.GetRequestAsync <PageListFB>(It.IsAny <string>(), null,
                                                                                    It.IsAny <Dictionary <string, string> >(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(responsePart1)
            .ReturnsAsync(responseLastPart);
            var facebookProvider = new FacebookProvider(new AzureTableProvider(Settings.StorageAccountConnectionString))
            {
                Client = restApiRepositoryMock.Object
            };
            var queryParams = new Dictionary <string, string> {
                { "access_token", "any" }, { "fields", "id,name" }
            };
            var allPages = await facebookProvider.GatherAllPages(queryParams);

            Assert.AreEqual(responsePart1.Data[0], allPages[0]);
            Assert.AreEqual(responseLastPart.Data[0], allPages[1]);
        }