Beispiel #1
0
        public void OmitMessageTest_SameMsgId()
        {
            //发送两条相同MsgId的消息
            var messageHandler = new OmitRepeatMessageMessageHandlers(XDocument.Parse(string.Format(xmlText, "21", "Jeffrey")), _postModel);

            messageHandler.OmitRepeatedMessage = true;
            messageHandler.Execute();
            Assert.IsNotNull(messageHandler.ResponseMessage);
            Assert.AreEqual("Jeffrey", (messageHandler.ResponseMessage as ResponseMessageText).Content);

            messageHandler = new OmitRepeatMessageMessageHandlers(XDocument.Parse(string.Format(xmlText, "21", "Su")), _postModel);
            messageHandler.OmitRepeatedMessage = true;
            messageHandler.Execute();
            Assert.IsNull(messageHandler.ResponseMessage);
        }
Beispiel #2
0
        public void OmitMessageTest_NotOmit()
        {
            //发送两条相同MsgId的消息,但是不启用忽略
            var messageHandler = new OmitRepeatMessageMessageHandlers(XDocument.Parse(string.Format(xmlText, "31", "Jeffrey")));

            messageHandler.OmitRepeatedMessage = false;
            messageHandler.Execute();
            Assert.IsNotNull(messageHandler.ResponseMessage);
            Assert.AreEqual("Jeffrey", (messageHandler.ResponseMessage as ResponseMessageText).Content);

            messageHandler = new OmitRepeatMessageMessageHandlers(XDocument.Parse(string.Format(xmlText, "31", "Su")));
            messageHandler.OmitRepeatedMessage = false;
            messageHandler.Execute();
            Assert.IsNotNull(messageHandler.ResponseMessage);
            Assert.AreEqual("Su", (messageHandler.ResponseMessage as ResponseMessageText).Content);
        }