Пример #1
0
        public void TestSyncQueueInvoke()
        {
            var syncQueue = new DacTaskResultConsumerQueue(ConsumeType.Sync);

            syncQueue.Enqueue(DacTaskResultConsumerService.GetConsumer("C1"));
            syncQueue.Enqueue(DacTaskResultConsumerService.GetConsumer("C2"));
            syncQueue.Enqueue(DacTaskResultConsumerService.GetConsumer("C3"));

            DacTaskResultConsumerService.AddComsumerQueue(syncQueue);

            var rslt1 = new List <SensorAcqResult>();

            rslt1.Add(new SensorAcqResult()
            {
                Data = new SensorData(new double[] { 65, 45, 87 }, new double[] { 12, 23, 56 }, new double[] { 65, 45, 87 })
            });
            rslt1[0].ErrorCode = 1;
            DacTaskResultConsumerService.OnDacTaskResultProduced(rslt1);
            //Thread.Sleep(8000);
            Console.WriteLine("source: {0}", rslt1[0].ErrorCode);
            Assert.AreNotEqual(7, rslt1[0].ErrorCode);


            //var rslt2 = new DACTaskResult();
            //rslt2.ErrorMsg = "队列2";
            //DacTaskResultConsumerService.OnDacTaskResultProduced(rslt2);
            ////Thread.Sleep(8000);
            //Console.WriteLine("source: {0}", rslt2.ErrorMsg);
            //Assert.AreNotEqual("C---1C---2C---3", rslt2.ErrorMsg);
            Thread.Sleep(5000);
        }
Пример #2
0
        public void TestInit()
        {
            DacTaskResultConsumerService.Init();

            Assert.AreEqual(
                DacTaskResultConsumerService.GetConsumer("DataAnalyzer").GetType().ToString(),
                "FS.SMIS_Cloud.DAC.DataAnalyzer.DataAnalyzer");

            Assert.AreEqual(
                DacTaskResultConsumerService.GetConsumer("DataAnalyzer").GetType(),
                DacTaskResultConsumerService.Queues[0][5].GetType());
        }
Пример #3
0
 public void TestGetConsumer()
 {
     Assert.AreEqual(
         "FS.SMIS_Cloud.DAC.DataAnalyzer.DataAnalyzer",
         DacTaskResultConsumerService.GetConsumer("test").GetType().ToString());
 }
Пример #4
0
 public void TestRegisterConsumer()
 {
     Assert.IsNotNull(DacTaskResultConsumerService.GetConsumer("test"));
 }