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"); }
/// Populate indexed search results in queue with images found from their link private async Task FetchPreviewImages() { while (_fetchImageQueue.Count > 0) { var currRes = _fetchImageQueue.Dequeue(); var result = _results[currRes]; var images = await _iretriever.RetrieveImages(result.Link); if (images != null && images.Count > 0) { result.Images = images; } _results[currRes] = result; } }