Exemplo n.º 1
0
        public void Unsubscribe()
        {
            var compositeDataQueueHandler = new DataQueueHandlerManager();

            compositeDataQueueHandler.Unsubscribe(GetConfig());
            compositeDataQueueHandler.Dispose();
        }
Exemplo n.º 2
0
 public void SubscribeReturnsNull()
 {
     var compositeDataQueueHandler = new DataQueueHandlerManager();
     var enumerator = compositeDataQueueHandler.Subscribe(GetConfig(), (_, _) => {});
     Assert.Null(enumerator);
     compositeDataQueueHandler.Dispose();
 }
Exemplo n.º 3
0
        public void MappedConfig(bool canonicalUnsubscribeFirst)
        {
            TestDataHandler.UnsubscribeCounter = 0;
            TestDataHandler.SubscribeCounter   = 0;
            var compositeDataQueueHandler = new DataQueueHandlerManager();

            compositeDataQueueHandler.SetJob(new LiveNodePacket {
                Brokerage = "OandaBrokerage", DataQueueHandler = "[ \"TestDataHandler\" ]"
            });

            var canonicalSymbol = Symbols.ES_Future_Chain.UpdateMappedSymbol(Symbols.Future_ESZ18_Dec2018.ID.ToString());
            var canonicalConfig = GetConfig(canonicalSymbol);
            var contractConfig  = GetConfig(Symbols.Future_ESZ18_Dec2018);

            var enumerator  = new LiveSubscriptionEnumerator(canonicalConfig, compositeDataQueueHandler, (_, _) => {});
            var enumerator2 = new LiveSubscriptionEnumerator(contractConfig, compositeDataQueueHandler, (_, _) => {});

            var firstUnsubscribe  = canonicalUnsubscribeFirst ? canonicalConfig : contractConfig;
            var secondUnsubscribe = canonicalUnsubscribeFirst ? contractConfig : canonicalConfig;

            Assert.AreEqual(2, TestDataHandler.SubscribeCounter);

            compositeDataQueueHandler.UnsubscribeWithMapping(firstUnsubscribe);
            Assert.AreEqual(1, TestDataHandler.UnsubscribeCounter);

            compositeDataQueueHandler.UnsubscribeWithMapping(secondUnsubscribe);
            Assert.AreEqual(2, TestDataHandler.UnsubscribeCounter);

            enumerator.Dispose();
            enumerator2.Dispose();
            compositeDataQueueHandler.Dispose();
        }
Exemplo n.º 4
0
 public void IsNotUniverseProvider()
 {
     var compositeDataQueueHandler = new DataQueueHandlerManager();
     Assert.IsFalse(compositeDataQueueHandler.HasUniverseProvider);
     Assert.Throws<NotSupportedException>(() => compositeDataQueueHandler.LookupSymbols(Symbols.ES_Future_Chain, false));
     Assert.Throws<NotSupportedException>(() => compositeDataQueueHandler.CanPerformSelection());
     compositeDataQueueHandler.Dispose();
 }
Exemplo n.º 5
0
        public void DoubleSubscribe()
        {
            var compositeDataQueueHandler = new DataQueueHandlerManager();
            compositeDataQueueHandler.SetJob(new LiveNodePacket { DataQueueHandler = "[ \"TestDataHandler\" ]" });

            var dataConfig = GetConfig();
            var enumerator = compositeDataQueueHandler.Subscribe(dataConfig, (_, _) => {});

            Assert.Throws<ArgumentException>(() => compositeDataQueueHandler.Subscribe(dataConfig, (_, _) => { }));
            compositeDataQueueHandler.Dispose();
        }
Exemplo n.º 6
0
 public void SetJob()
 {
     //Array IDQH
     var dataHandlers = Newtonsoft.Json.JsonConvert.SerializeObject(new[] { "FakeDataQueue" });
     var jobWithArrayIDQH = new LiveNodePacket
     {
         DataQueueHandler = dataHandlers
     };
     var compositeDataQueueHandler = new DataQueueHandlerManager();
     compositeDataQueueHandler.SetJob(jobWithArrayIDQH);
     compositeDataQueueHandler.Dispose();
 }
Exemplo n.º 7
0
 public void SubscribeReturnsNotNull()
 {
     var dataHandlers = Newtonsoft.Json.JsonConvert.SerializeObject(new[] { "FakeDataQueue" });
     var job = new LiveNodePacket
     {
         DataQueueHandler = dataHandlers
     };
     var compositeDataQueueHandler = new DataQueueHandlerManager();
     compositeDataQueueHandler.SetJob(job);
     var enumerator = compositeDataQueueHandler.Subscribe(GetConfig(), (_, _) => {});
     Assert.NotNull(enumerator);
     compositeDataQueueHandler.Dispose();
     enumerator.Dispose();
 }
Exemplo n.º 8
0
        public void SingleSubscribe()
        {
            TestDataHandler.UnsubscribeCounter = 0;
            var compositeDataQueueHandler = new DataQueueHandlerManager();
            compositeDataQueueHandler.SetJob(new LiveNodePacket { DataQueueHandler = "[ \"TestDataHandler\" ]" });

            var dataConfig = GetConfig();
            var enumerator = compositeDataQueueHandler.Subscribe(dataConfig, (_, _) => {});

            compositeDataQueueHandler.Unsubscribe(dataConfig);
            compositeDataQueueHandler.Unsubscribe(dataConfig);
            compositeDataQueueHandler.Unsubscribe(dataConfig);

            Assert.AreEqual(1, TestDataHandler.UnsubscribeCounter);

            compositeDataQueueHandler.Dispose();
        }