Esempio n. 1
0
        private void ReflashStatus()
        {
            lblComStatus.Text          = _TheSmsControllor.GetPortStatus() ? "打开" : "关闭";
            lblWorkThreadStatus.Text   = _TheSmsControllor.GetWorkThreadStatus() ? "打开" : "关闭";
            lblTheEventHasHandler.Text = _TheSmsControllor.GetTheBoardStatus() ? "是" : "否";

            List <SendMessageDataModel> waitSendMessages = _TheSmsControllor.GetLogsForWaitSendMessages();

            gvWait.DataSource = waitSendMessages;
            gvWait.DataBind();
            lblWait.Text = waitSendMessages.Count + "条记录";

            List <ReceiveMessageDataModel> receivedMessage = _TheSmsControllor.GetLogsForReceiveMessages();

            gvReceive.DataSource = receivedMessage;
            gvReceive.DataBind();
            lblReceive.Text = receivedMessage.Count + "条记录";

            List <SendMessageDataModel> failedSendMessage = _TheSmsControllor.GetLogsForFailedSendMessages();

            gvFailed.DataSource = failedSendMessage;
            gvFailed.DataBind();
            lblFailed.Text = failedSendMessage.Count + "条记录";

            List <SendMessageDataModel> successSendMessage = _TheSmsControllor.GetLogsForSuccesssSendMessages();

            gvSuccess.DataSource = successSendMessage;
            gvSuccess.DataBind();
            lblSuccess.Text = successSendMessage.Count + "条记录";
        }
        public void Test6()
        {
            //清空Log数据
            theController.ClearAllReceivedMessages();
            theController.ClearAllSendMessages();

            //该短信无法发送成功
            theController.DelieveAMessage(new SendMessageDataModel(-1, "10086", "余额查询", "testDll"));
            //打开端口,开始收发短信线程
            theController.StartConnection();
            theController.StartTheSmsThread();
            Assert.IsTrue(theController.GetWorkThreadStatus());
            //在中途加入可以发送成功的一条短信
            Thread.Sleep(3000);
            theController.DelieveAMessage(new SendMessageDataModel(-1, "10086", "YECX", "testDll"));
            Thread.Sleep(60000);
            theController.StopTheSmsThread();
            theController.StopConnection();
            //-----验证短信Logs
            Assert.AreEqual(1, theController.GetLogsForSuccesssSendMessages().Count);
            Assert.AreEqual(2, theController.GetLogsForWaitSendMessages().Count);
            Assert.AreEqual(1, theController.GetLogsForReceiveMessages().Count);
            Assert.AreEqual(1, theController.GetLogsForFailedSendMessages().Count);
        }