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();
        }
 public void SubscribeReturnsNull()
 {
     var compositeDataQueueHandler = new DataQueueHandlerManager();
     var enumerator = compositeDataQueueHandler.Subscribe(GetConfig(), (_, _) => {});
     Assert.Null(enumerator);
     compositeDataQueueHandler.Dispose();
 }
 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();
 }
        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();
        }