Example #1
0
        public void TestProviderMemoryCache()
        {
            var candles = new List <Candle>();

            using (var p1 = new TextCandleProvider())
            {
                p1.SetTextParams(@"data\si-9-17.dat");
                Assert.IsTrue(p1.Initialize());
                candles.Add(p1.Current);
                while (p1.MoveNext())
                {
                    candles.Add(p1.Current);
                }
            }
            var p = new TextCandleProvider();

            p.SetTextParams(@"data\si-9-17.dat");
            // p gets automatically disposed
            using (var mc = new MemoryCache <TextCandleProvider>(p))
            {
                var num = 0;
                while (mc.MoveNext())
                {
                    Assert.AreEqual(candles[num], mc.Current);
                    num++;
                }
                mc.Reset();
                mc.MoveNext();
                Assert.AreEqual(candles[0], mc.Current);
            }
        }
 public void TestTextCandleProviderInitialization()
 {
     using (var provider = new TextCandleProvider())
     {
         Assert.IsTrue(provider.Initialize());
     }
 }