/// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <BestStoryInfo> > GetAllBestStoriesInfoAsync(this IHackerNewsAPI operations, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetAllBestStoriesInfoWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 public HackerNewsClientTests()
 {
     _api        = new HackerNewsMockAPI();
     _localCache = new MemoryCache(Options.Create(new MemoryCacheOptions()));
     _distCache  = new MemoryDistributedCache(Options.Create(new MemoryDistributedCacheOptions()));
     _client     = new HackerNewsClient(_api, _localCache, _distCache);
 }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static IList <BestStoryInfo> GetAllBestStoriesInfo(this IHackerNewsAPI operations)
 {
     return(Task.Factory.StartNew(s => ((IHackerNewsAPI)s).GetAllBestStoriesInfoAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Exemple #4
0
 public HackerNewsController(IHackerNewsAPI service, IMemoryCache cache)
 {
     _service = service;
     _cache   = cache;
 }
 public NewsController(IHackerNewsAPI hackerNewsAPI)
 {
     _hackerNewsAPI = hackerNewsAPI;
 }
Exemple #6
0
 public HackerNewsClient(IHackerNewsAPI api, IMemoryCache localCache, IDistributedCache distCache)
 {
     _api        = api;
     _localCache = localCache;
     _distCache  = distCache;
 }