Beispiel #1
0
        public async Task RetrievesData()
        {
            IDataProvider      dataProvider      = new HackerNewsProvider(configurationMock.Object);
            IHackerNewsService hackerNewsService = new HackerNewsService(dataProvider);
            var result = await hackerNewsService.GetBestStoriesAsync();

            Assert.IsTrue(result.Any());
        }
        private async Task <IEnumerable <BestStory> > GetStoriesData()
        {
            MemoryCacheOptions options           = new MemoryCacheOptions();
            IMemoryCache       memoryCache       = new MemoryCache(options);
            IDataProvider      dataProvider      = new HackerNewsProvider(configurationMock.Object);
            IHackerNewsService hackerNewsService = new HackerNewsService(dataProvider);
            IStoryService      storyService      = new StoryService(hackerNewsService, configurationMock.Object, memoryCache);

            return(await storyService.GetBestStoriesAsync());
        }
Beispiel #3
0
        public async Task <List <NewsListItemDto> > GetAsync()
        {
            var newsProvider = new HackerNewsProvider();

            return(await newsProvider.List());
        }
 public HackerNewsProviderTests()
 {
     pageLoader = NSubstitute.Substitute.For <IAngleSharpPageLoader>();
     hackerNewsHtmlDocumentParser = Substitute.For <IHtmlDocumentParser>();
     newsProvider = new HackerNewsProvider(pageLoader, hackerNewsHtmlDocumentParser);
 }