static void Main(string[] args) { MarketplaceDataService marketplaceDataService = new MarketplaceDataService(); Console.WriteLine("***** Marketplace data *****"); marketplaceDataService.GetMarketplaceData(); }
public void HorriblyBadVeryNaiveSortOfIntegrationTest() { var dataService = new MarketplaceDataService(); var cacheManager = new Cache.CacheManager <IExtensionDataItemView, ExtensionDataItem>(CacheFilePath); dataService.GetMarketplaceDataItems( "15.0", new[] { "Pro", "Ultimate" }, DateTime.MinValue, (items) => { cacheManager.AddRange(items); return(true); }); // Hit the back-end and check for actual results and write them to disk. // Without knowing what to expect, we can't validate these (other than by hand) // but a non-zero list is a good sign :) Assert.IsTrue(cacheManager.Snapshot.Count > 500); var itemsCount = cacheManager.Snapshot.Count; Assert.IsTrue(cacheManager.TrySaveCacheFile()); cacheManager.ReplaceAll(Enumerable.Empty <IExtensionDataItemView>()); Assert.IsTrue(cacheManager.Snapshot.Count == 0); Assert.IsTrue(cacheManager.TryLoadCacheFile()); Assert.AreEqual(itemsCount, cacheManager.Snapshot.Count); }
private static void FirstTimeInitialize() { cacheManager = new CacheManager <IExtensionDataItemView, ExtensionDataItem>(Path.Combine(Utilities.ExtensionAppDataPath, CacheFileName)); marketPlaceService = new MarketplaceDataService(); // Load cached results from disk, or fallback to over the wire refresh, if stale or non-existant. if (!cacheManager.TryLoadCacheFile() || DateTime.UtcNow.Subtract(cacheManager.LastCacheFileUpdateTimeStamp.Value) > TimeSpan.FromDays(1)) { RefreshCache(); } }