Exemplo n.º 1
0
        public async Task DoWork()
        {
            var retriever = new ImageRetrieverService(limit: _imgPerPage);
            var results   = await retriever.RetrieveImages(Link);

            Images = results.ToObservableCollection();
        }
        public void RetrieveImages_UnknownSite_ReturnsEmptyList()
        {
            var testUrl = "https://www.google.com";
            var service = new ImageRetrieverService();
            List <OnlineImageResult> results = service.RetrieveImages(testUrl).Result;

            Assert.AreEqual(0, results.Count);
        }
        public void RetrieveImages_KnownSiteDifferentLimit_ReturnsCorrectInfo()
        {
            var testUrl = "https://www.instagram.com/aimyon36/";
            var service = new ImageRetrieverService(limit: 3);
            List <OnlineImageResult> results = service.RetrieveImages(testUrl).Result;

            Assert.AreEqual(3, results.Count);
            OnlineImageResult third = results[2];

            StringAssert.Contains(third.Link, "jpg");
        }
        public void RetrieveImages_KnownSiteDefaultLimit_ReturnsCorrectInfo()
        {
            var testUrl = "https://www.instagram.com/aimyon36/";
            var service = new ImageRetrieverService();
            List <OnlineImageResult> results = service.RetrieveImages(testUrl).Result;

            Assert.AreEqual(2, results.Count);
            OnlineImageResult first = results[0];

            StringAssert.Contains(first.Link, "jpg");
        }