Пример #1
0
        public void StoreData_UsesTypeName_AsKey()
        {
            var data = new DynamicSecurityData(RegisteredSecurityDataTypesProvider.Null);

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

            Assert.IsTrue(data.HasProperty(typeof(int).Name));

            var arr = (IReadOnlyList <int>)data.GetProperty(typeof(int).Name);

            Assert.AreEqual(1, arr.Count);
            Assert.AreEqual(1, arr[0]);
        }
Пример #2
0
        public void StoreData_UsesTypeName_AsKey()
        {
            var data = new DynamicSecurityData(_dataTypesProvider, _cache);

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

            Assert.IsTrue(data.HasProperty(typeof(TradeBar).Name));

            var arr = (IReadOnlyList <TradeBar>)data.GetProperty(typeof(TradeBar).Name);

            Assert.AreEqual(1, arr.Count);
            Assert.AreEqual(15, arr[0].Close);
        }