Exemple #1
0
        public void Get_UsesTypeName_AsKey_And_ReturnsLastItem()
        {
            var data = new DynamicSecurityData(RegisteredSecurityDataTypesProvider.Null);

            data.StoreData(typeof(int), new[] { 1, 2, 3 });

            var item = data.Get <int>();

            Assert.AreEqual(3, item);
        }
        public void Get_UsesTypeName_AsKey_And_ReturnsLastItem()
        {
            var data = new DynamicSecurityData(_dataTypesProvider, _cache);

            _cache.StoreData(new List <TradeBar> {
                new TradeBar(DateTime.UtcNow, Symbols.SPY, 10m, 20m, 5m, 1, 10000),
                new TradeBar(DateTime.UtcNow, Symbols.SPY, 10m, 20m, 5m, 2, 10000),
                new TradeBar(DateTime.UtcNow, Symbols.SPY, 10m, 20m, 5m, 3, 10000)
            }, typeof(TradeBar));

            var item = data.Get <TradeBar>();

            Assert.AreEqual(3, item.Close);
        }