public object Get(GetFinancialDataSources request) { var response = new GetFinancialDataSourcesResponse(); try { string key = string.Empty; OperationResult <List <DataSource> > result; if (Request.PathInfo.EndsWith("all")) { key = "AllFinacialDataSources"; var cached = _cachingManager.GetFinancialDataSources(key); if (cached != null) { return(cached); } result = _dataProvider.GetAllFinancialDataSources(QuandlSettings.QuandlWebUrl); } else { key = "FinacialDataSources"; var cached = _cachingManager.GetFinancialDataSources(key); if (cached != null) { return(cached); } result = _dataProvider.GetFinancialDataSources(); } if (result.Success) { response.Success = true; response.Data = result.Data; _cachingManager.Save(key, response); } else { response.ResponseStatus = new ResponseStatus(string.Empty, result.ErrorMessage); } } catch (Exception ex) { var status = new ResponseStatus(); status.Message = ex.Message; status.ErrorCode = ex.Source; status.StackTrace = ex.StackTrace; response.ResponseStatus = status; } return(response); }
public void Get_FinancialDataSources() { // Arrange // Act var dataSource = _dataProvider.GetFinancialDataSources(); // Assert Assert.True(dataSource.Success); Assert.True(dataSource.Data.Any()); }