예제 #1
0
    public async void HistoryListWithValuesSucceeds()
    {
        var historyOptions = new HistoryOptions(values: true);
        var listResults    = await collection.HistoryAsync <Product>(productKey, historyOptions);

        Assert.Collection(listResults.Items,
                          result =>
        {
            Assert.Equal(1, result.Value.Id);
            Assert.Equal("1", result.PathMetadata.Key);
            Assert.Equal("Whole Grain Bread", result.Value.Description);
        },
                          result =>
        {
            Assert.Null(result.Value);
            Assert.True(result.PathMetadata.Tombstone);
            Assert.Equal("1", result.PathMetadata.Key);
        },
                          result =>
        {
            Assert.Equal(1, result.Value.Id);
            Assert.Equal("1", result.PathMetadata.Key);
            Assert.Equal("Grain Bread", result.Value.Description);
        }
                          );
    }
예제 #2
0
    public async void HistoryWithLimitSucceeds()
    {
        var options    = new HistoryOptions(limit: 1);
        var listResult = await collection.HistoryAsync <Product>("1", options);

        Assert.Equal(1, listResult.Count);
        Assert.Contains("offset=1&limit=1", listResult.Next);
    }
예제 #3
0
 public IndexHistoryService(
     ICacheProvider <IndexHistoryData> cacheProvider,
     IHttpClientService httpClientService,
     IOptions <HistoryOptions <Index> > config,
     ILogger <IndexHistoryService> logger) : base(cacheProvider, logger)
 {
     _httpClientService = httpClientService;
     _config            = config.Value;
 }
예제 #4
0
 public CurrencyHistoryService(
     ICacheProvider <CurrencyHistoryData> cacheProvider,
     ILogger <CurrencyHistoryService> logger,
     IHttpClientService httpClientService,
     CurrencySourceService currencySourceService,
     SecurityStaticDataService staticDataService,
     IOptions <HistoryOptions <Currency> > config) : base(cacheProvider, logger)
 {
     _httpClientService     = httpClientService;
     _currencySourceService = currencySourceService;
     _staticDataService     = staticDataService;
     _config = config.Value;
 }
예제 #5
0
 public BondHistoryService(
     ICacheProvider <BondHistoryData> cacheProvider,
     ILogger <BondHistoryService> logger,
     IHttpClientService httpClientService,
     BondSourceService bondSourceService,
     SecurityStaticDataService staticDataService,
     IOptions <HistoryOptions <Bond> > config) : base(cacheProvider, logger)
 {
     _httpClientService = httpClientService;
     _bondSourceService = bondSourceService;
     _staticDataService = staticDataService;
     _config            = config.Value;
 }
예제 #6
0
    public async void HistoryWithOffsetSucceeds()
    {
        var options    = new HistoryOptions(offset: 2, values: true);
        var listResult = await collection.HistoryAsync <Product>("1", options);

        Assert.Null(listResult.Next);
        Assert.Collection(listResult.Items,
                          result =>
        {
            Assert.Equal(1, result.Value.Id);
            Assert.Equal("1", result.PathMetadata.Key);
            Assert.Equal("Grain Bread", result.Value.Description);
        }
                          );
    }
예제 #7
0
 public ShareHistoryService(
     ICacheProvider <ShareHistoryData> cacheProvider,
     ILogger <ShareHistoryService> logger,
     IHttpClientService httpClientService,
     ShareSourceService shareSourceService,
     EtfSourceService etfSourceService,
     SecurityStaticDataService staticDataService,
     IOptions <HistoryOptions <Share> > config) : base(cacheProvider, logger)
 {
     _httpClientService  = httpClientService;
     _staticDataService  = staticDataService;
     _shareSourceService = shareSourceService;
     _etfSourceService   = etfSourceService;
     _config             = config.Value;
 }
예제 #8
0
 public FuturesContractService(
     IHttpClientService getService,
     ICacheProvider <string> stringCacheProvider,
     ICacheProvider <FuturesContract> contractCacheProvider,
     IOptions <MarketOptions <Futures> > marketConf,
     IOptions <HistoryOptions <Futures> > historyConf,
     SecurityStaticDataService staticDataService,
     ILogger <FuturesContractService> logger)
 {
     _getService            = getService;
     _stringCacheProvider   = stringCacheProvider;
     _contractCacheProvider = contractCacheProvider;
     _marketConf            = marketConf.Value;
     _historyConf           = historyConf.Value;
     _staticDataService     = staticDataService;
     _logger = logger;
     _futuresContractHistoryOffset = TimeSpan.FromDays(365 * 3 + 30);
 }