public SymbolSearchResultDTO(SymbolSearchResult searchResult, Symbol symbol) { Delisted = symbol.Delisted; ExchangeId = symbol.ExchangeId; ExchangeName = symbol.ExchangeName; FullName = searchResult.FullName; Match = searchResult.Match; Ticker = searchResult.Ticker; SymbolId = symbol.Id; }
public async Task GetSearchedTickers_ShouldReturnMatchingSymbols() { var stockSymbol = "MSFT"; var alphaVantageClient = new AlphaVantageClient(_mockHttpFactory, _mockAlphaVantageOptionsAccessor.Object, _parserFactory, _mockLogger.Object); IEnumerable <SymbolSearchResult> searchResults = await alphaVantageClient.GetSearchedTickers(stockSymbol); Assert.True(searchResults.Count() > 0); Assert.Equal(stockSymbol, searchResults.First().Ticker); SymbolSearchResult msftSymbol = searchResults.First(); Assert.Contains("Microsoft", msftSymbol.FullName); Assert.Equal(1.0000m, msftSymbol.Match); }
public async Task <ActionResult> ResultsAsHtml([FromUri(Name = "q")] string searchTerm) { try { Requests.LogRequest(this, searchTerm); searchTerm = HttpUtility.UrlDecode(searchTerm); if (string.IsNullOrWhiteSpace(searchTerm)) { //Still render view even if we have an invalid search term - it'll display a "results not found" message Debug.WriteLine("GetSearchResult - searchTerm is null or whitespace"); return(PartialView()); } if (searchTerm.StartsWith("`")) { return(await TextSearchResults(searchTerm)); } SymbolSearchResult searchResult = null; string term; Classification? classification; ParseSearchTerm(searchTerm, out term, out classification); Responses.PrepareResponse(Response); searchResult = await storage.SearchAsync(this.GetSearchRepos(), searchTerm); if (searchResult.Total == 0) { return(await TextSearchResults(searchTerm)); } return(PartialView(searchResult)); } catch (Exception ex) { return(Responses.Exception(ex)); } }