Esempio n. 1
0
        private async Task <SymbolSearchResultDTO> FetchSymbol(string ticker, ExchangeType exchange)
        {
            var response = await _client.GetAsync(ApiPath.SymbolSearch(ticker, 1));

            response.EnsureSuccessStatusCode();
            var searchResults = await response.Content.ReadAsAsync <IEnumerable <SymbolSearchResultDTO> >();

            var result = searchResults.Single();

            Assert.Equal(ticker, result.Ticker);

            return(searchResults.Single());
        }
Esempio n. 2
0
        private async Task <SymbolSearchResultDTO> SearchSymbol(string ticker, ExchangeType exchange)
        {
            var response = await _client.GetAsync(ApiPath.SymbolSearch(ticker, 1));

            response.EnsureSuccessStatusCode();
            var searchResultsJson = await response.Content.ReadAsStringAsync();

            var settings = new JsonSerializerSettings();

            settings.MissingMemberHandling = MissingMemberHandling.Error;
            settings.NullValueHandling     = NullValueHandling.Include;

            var searchResults = JsonConvert.DeserializeObject <IEnumerable <SymbolSearchResultDTO> >(searchResultsJson, settings);

            var result = searchResults.Single();

            Assert.Equal(ticker, result.Ticker);

            return(searchResults.Single());
        }