public async Task <ICollection <StockSymbolSearch> > RequestSymbolSearchAsync(string keywords) { var query = new Dictionary <string, string>() { { StockApiQueryVars.Keywords, keywords }, }; var jObject = await _coreClient.RequestApiAsync(_apiKey, ApiFunction.SYMBOL_SEARCH, query); var matches = _parser.ParseSymbolSearch(jObject); return(matches); }
public void SymbolSearch_ParsingTest() { var json = File.ReadAllText("Data/symbol-search.json"); var jObject = (JObject)JsonConvert.DeserializeObject(json); var parser = new StockDataParser(); var result = parser.ParseSymbolSearch(jObject); Assert.NotNull(result); Assert.Equal(3, result.Count); Assert.True( result.Any(r => r.Symbol == "BA") && result.Any(r => r.Symbol == "BAC") && result.Any(r => r.Symbol == "BABA")); }