Ejemplo n.º 1
0
        public void Setup()
        {
            _fixture    = new Fixture();
            _storiesAcl = new Mock <IStoriesAcl>();


            _idStoriesResponse = _fixture.Create <IDStoriesResponse>();

            List <StoriesDescriptionResponse> storiesDescriptionResponse = _fixture.Create <List <StoriesDescriptionResponse> >();

            _chain = new StoriesIDsChain(_storiesAcl.Object)
            {
                Next = new DafaultChain <BestStoriesChainParameters, List <StoriesDescriptionResponse> >(storiesDescriptionResponse)
            };
        }
Ejemplo n.º 2
0
        public async Task <IDStoriesResponse> GetStoriesIDs()
        {
            IDStoriesResponse ResponseIDs = new IDStoriesResponse();
            var suffix     = _config.GetValue <string>("sufix.url.listid.api", "v0/beststories.json");
            var urlApiBase = _config.GetValue <string>("base.url.api", "https://hacker-news.firebaseio.com/");

            var response = await _httpService.CallHttp(
                (url) => url
                .WithHeader("Accept", "application/json")
                .GetAsync()
                .ReceiveJson <List <long> >(),
                urlApiBase, string.Format(suffix));

            if (response.Result != null)
            {
                var first20 = response.Result.Take(20);
                ResponseIDs = new IDStoriesResponse {
                    IDStoriesList = first20.ToList()
                };
            }

            return(ResponseIDs);
        }