Exemple #1
0
        public async Task <ApiNewsItem[]> GetNews(TimeSpan?expireDateTime = default)
        {
            var timeUpdated = expireDateTime ?? _settings.CacheUpdateInterval;

            Func <Task <ApiNewsItem[]> > dataSource = () => _mireaApiClient.GetNews();

            var news = await LocalCacheProvider.GetAsync(LocalCacheHelper.NewsCacheKey, dataSource, timeUpdated);

            return(news);
        }
Exemple #2
0
        public async Task GetNews()
        {
            var actualNews = await _mireaApiClient.GetNews();

            Assert.NotEmpty(actualNews);

            Assert.NotNull(actualNews.First().Title);
            Assert.NotNull(actualNews.First().Content);
            Assert.NotEmpty(actualNews.First().Photos);
        }