private async Task <PocketItem> TestAddAsync() { PocketItem newPocketItem = await _pocketClient.AddPocketItemAsync(new Uri("https://www.theage.com.au/culture/comedy/the-at-home-comedy-festival-20200318-p54bhu.html")); List <PocketItem> newPocketItems = await _pocketClient.GetPocketItemsAsync( DateTime.Now.ToUniversalTime().Subtract(new TimeSpan(0, 0, 30))); Assert.IsNotNull(newPocketItem); Assert.IsNotNull(newPocketItem.Id); Assert.AreNotEqual(0, newPocketItem.Id.Length); Assert.AreNotEqual(0, newPocketItems.Count); return(newPocketItem); }
public async Task TestDeleteArticleAsync() { PocketCache pocketCache = new PocketCache(pocketClient); await pocketCache.SyncArticlesAsync(); if (!pocketCache.PocketItems.Any(pi => pi.GivenUrl == testArticleUrl)) { await pocketClient.AddPocketItemAsync(new Uri(testArticleUrl)); } int articleCountStart = pocketCache.PocketItems.Count; PocketItem pocketItem = pocketCache.PocketItems.First(pi => pi.GivenUrl == "https://www.theage.com.au/culture/music/inside-the-private-world-of-nick-cave-love-life-and-doodles-20200326-p54e4z.html"); await pocketCache.DeleteArticleAsync(pocketItem); int articleCountEnd = pocketCache.PocketItems.Count; Assert.AreNotEqual(articleCountStart, articleCountEnd); Assert.IsTrue(articleCountEnd < articleCountStart); Assert.IsTrue(articleCountEnd == articleCountStart - 1); }
public async Task AddArticleAsync(Uri uri) { PocketItem pocketItem = await _pocketClient.AddPocketItemAsync(uri); await SyncArticlesAsync(); }