Beispiel #1
0
        public void TestPFEmailMq()
        {
            var resMsg = "";

            var p = new PagingParameters();

            p["backupDatabase"] = "bonus";

            TestPFEmailMqConsumer tmpObj = new TestPFEmailMqConsumer();

            PFMqHelper.BuildConsumer(tmpObj);
            Thread.Sleep(2000);//不延迟的话,后面太快了,前面还没开始监听

            var st      = DateTime.Now;
            var message = JsonConvert.SerializeObject(p);
            var t       = PFMqHelper.BuildProducer(message,
                                                   new TestPFEmailMqProducer());

            t.Wait();
            var et = DateTime.Now;

            resMsg = t.Result.Body;

            var usedTime = PFDataHelper.GetTimeSpan(et - st);//平均6秒

            Assert.IsTrue(resMsg == JsonConvert.SerializeObject("接收到信息:" + message));
            //Assert.IsTrue(true);
        }
Beispiel #2
0
        public void TestPFEmailMq2()
        {
            #region 消费者
            TestMonthDataCompareCntConsumer consumer = new TestMonthDataCompareCntConsumer();
            PFMqHelper.BuildConsumer(consumer);
            Thread.Sleep(2000);//不延迟的话,后面太快了,前面还没开始监听
            #endregion

            var cacheList = TestMonthDataCompareCntProducer.Product("bonus");

            Assert.IsTrue(cacheList != null && cacheList.Any());
            //Assert.IsTrue(true);
        }