Exemple #1
0
        public void UnknowTypeMessageTest()
        {
            var requestXmlFormat = @"<?xml version=""1.0"" encoding=""utf-8""?>
<xml>
    <ToUserName><![CDATA[gh_a96a4a619366]]></ToUserName>
    <FromUserName><![CDATA[{0}]]></FromUserName>
    <CreateTime>1357986928</CreateTime>
    <MsgType><![CDATA[{1}]]></MsgType>
    <Content><![CDATA[TNT2]]></Content>
    <MsgId>5832509444155992350</MsgId>
</xml>
";
            var types            = new[] { "unknown1", "unknown2", "unknown3" };

            foreach (var type in types)
            {
                var fileXml = requestXmlFormat.FormatWith("JeffreySu", type);

                var messageHandler = new CustomMessageHandlers(XDocument.Parse(fileXml));
                messageHandler.OmitRepeatedMessage = false;//禁用去重机制
                messageHandler.Execute();
                Assert.IsInstanceOfType(messageHandler.ResponseMessage, typeof(ResponseMessageText));
                Assert.AreEqual("未知消息类型:{0}".FormatWith(type), ((ResponseMessageText)messageHandler.ResponseMessage).Content);
            }
        }
Exemple #2
0
        public void OnSubscribeTest()
        {
            var requestXML      = @"<?xml version=""1.0"" encoding=""utf-8""?>
<xml>
<ToUserName><![CDATA[gh_0fe614101343]]></ToUserName>
<FromUserName><![CDATA[oxRg0uLsnpHjb8o93uVnwMK_WAVw]]></FromUserName>
<CreateTime>1516545128</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event>subscribe</Event>
<EventKey><![CDATA[]]></EventKey>
</xml>
";
            var messageHandlers = new CustomMessageHandlers(XDocument.Parse(requestXML));

            Assert.IsNotNull(messageHandlers.RequestDocument);
            Assert.IsInstanceOfType(messageHandlers.RequestMessage, typeof(RequestMessageEvent_Subscribe));
            Assert.AreEqual("", ((RequestMessageEvent_Subscribe)messageHandlers.RequestMessage).EventKey);//EventKey为空

            messageHandlers.Execute();
            Assert.IsNotNull(messageHandlers.ResponseMessage);
            Assert.IsNotNull(messageHandlers.ResponseDocument);
            Assert.IsInstanceOfType(messageHandlers.ResponseMessage, typeof(ResponseMessageText));
            Assert.AreEqual("欢迎关注", ((ResponseMessageText)messageHandlers.ResponseMessage).Content);
            Console.WriteLine(messageHandlers.FinalResponseDocument);
        }
Exemple #3
0
        public void FileTest()
        {
            //数据不全,未开始正式测试
            var postModel = new PostModel()
            {
                AppId         = "wx43899fc5fd7ab4dc",
                Msg_Signature = "a61aaa287b63782f8e5d801075e20e75bfe37af4",
                Timestamp     = "1519483978",
                Nonce         = "1122185331",

                Token          = "moZ05vVoeueufLTuCqv",
                EncodingAESKey = "68JptSBfCdTa12VRKa3Ztv4cDRbqlor8Kgy6c9l6bKK",
            };

            var messageHandler = new CustomMessageHandlers(XDocument.Parse(testFileXml), postModel, 10);

            messageHandler.Execute();

            Assert.IsInstanceOfType(messageHandler.RequestMessage, typeof(RequestMessageFile));
            Console.WriteLine(messageHandler.RequestDocument);

            Console.WriteLine(messageHandler.ResponseDocument);

            Assert.IsInstanceOfType(messageHandler.ResponseMessage, typeof(ResponseMessageText));
            Assert.AreEqual("95d98d3bf1b251a9e4a40f3bd88eef29", ((ResponseMessageText)messageHandler.ResponseMessage).Content);
        }
Exemple #4
0
        public void CompatibilityModelEcryptMessageRequestTest()
        {
            //兼容模式测试
            var ecryptXml = @"<xml>
    <ToUserName><![CDATA[gh_a96a4a619366]]></ToUserName>
    <FromUserName><![CDATA[olPjZjsXuQPJoV0HlruZkNzKc91E]]></FromUserName>
    <CreateTime>1414387151</CreateTime>
    <MsgType><![CDATA[text]]></MsgType>
    <Content><![CDATA[你好]]></Content>
    <MsgId>6074746557628292943</MsgId>
    <Encrypt><![CDATA[2gUBUpAeuPFKBS+gkcvrR1cBq1VjTOQluB7+FQF00VnybRpYR3xko4S4wh0qD+64cWmJfF93ZNLm+HLZBexjHLAdJBs5RBG2rP1AJnU0/1vQU/Ac9Q1Nq7vfC4l3ciF8YwhQW0o/GE4MYWWakgdwnp0hQ7aVVwqMLd67A5bsURQHJiFY/cH0fVlsKe6J3aazGhRXFCxceOq2VTJ2Eulc8aBDVSM5/lAIUA/JPq5Z2RzomM0+aoa5XIfGyAtAdlBXD0ADTemxgfYAKI5EMfKtH5za3dKV2UWbGAlJQZ0fwrwPx6Rs8MsoEtyxeQ52gO94gafA+/kIVjamKTVLSgudLLz5rAdGneKkBVhXyfyfousm1DoDRjQdAdqMWpwbeG5hanoJyJiH+humW/1q8PAAiaEfA+BOuvBk/a5xL0Q2l2k=]]></Encrypt>
</xml>";
            //signature=e3203b6433eb554dd2fcba78fa48cb948fcb4801&timestamp=1414387151&nonce=917222494&encrypt_type=aes&msg_signature=ae70d4e343d946fc0477a5c760b95be0947fddbb
            var postModel = new PostModel()
            {
                Msg_Signature = "ae70d4e343d946fc0477a5c760b95be0947fddbb",
                Timestamp     = "1414387151",
                Nonce         = "917222494",

                Token          = "weixin",
                EncodingAESKey = "mNnY5GekpChwqhy2c4NBH90g3hND6GeI4gii2YCvKLY",
                AppId          = "wx669ef95216eef885"
            };
            var messageHandlers = new CustomMessageHandlers(XDocument.Parse(ecryptXml), postModel);

            Assert.IsNotNull(messageHandlers.RequestDocument);
            Assert.IsNotNull(messageHandlers.RequestMessage);
            Assert.IsNotNull(messageHandlers.RequestMessage.Encrypt);
            Assert.IsNotNull(messageHandlers.RequestMessage.FromUserName);
            Assert.IsNotNull(messageHandlers.EcryptRequestDocument);
            Assert.IsTrue(messageHandlers.UsingEcryptMessage);
            Assert.IsTrue(messageHandlers.UsingCompatibilityModelEcryptMessage);
        }
Exemple #5
0
        public void Event_LocationSelectTest()
        {
            var requestXML      = @"<?xml version=""1.0"" encoding=""utf-8""?>
<xml>
<ToUserName>ToUserName</ToUserName>
<FromUserName>FromUserName</FromUserName>
<CreateTime>1444293582</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[location_select]]></Event>
<EventKey><![CDATA[ZBZXC]]></EventKey>
<SendLocationInfo><Location_X><![CDATA[31]]></Location_X>
<Location_Y><![CDATA[121]]></Location_Y>
<Scale><![CDATA[15]]></Scale>
<Label><![CDATA[嘉兴市南湖区政府东栅街道办事处(中环南路南)]]></Label>
<Poiname><![CDATA[南湖区富润路/中环南路(路口)旁]]></Poiname>
</SendLocationInfo>
</xml>
";
            var messageHandlers = new CustomMessageHandlers(XDocument.Parse(requestXML));

            Assert.IsNotNull(messageHandlers.RequestDocument);
            Assert.IsInstanceOfType(messageHandlers.RequestMessage, typeof(RequestMessageEvent_Location_Select));
            Assert.AreEqual("ZBZXC", ((RequestMessageEvent_Location_Select)messageHandlers.RequestMessage).EventKey);

            messageHandlers.Execute();
            Assert.IsNotNull(messageHandlers.ResponseMessage);
            Assert.IsNotNull(messageHandlers.ResponseDocument);
            Assert.IsFalse(messageHandlers.UsingEcryptMessage);                   //没有使用加密模式
            Assert.IsFalse(messageHandlers.UsingCompatibilityModelEcryptMessage); //没有加密模式,所以也没有兼容模式

            Console.WriteLine(messageHandlers.ResponseDocument.ToString());
            Assert.AreEqual("ToUserName", messageHandlers.ResponseMessage.FromUserName);
            Assert.IsInstanceOfType(messageHandlers.ResponseMessage, typeof(ResponseMessageText));
            Assert.AreEqual("OnEvent_LocationSelectRequest", ((ResponseMessageText)messageHandlers.ResponseMessage).Content);
        }
Exemple #6
0
        public void SyncTest()
        {
            //测试缓存同步
            var messageHandlers1 = new CustomMessageHandlers(XDocument.Parse(xmlText));
            var messageHandlers2 = new CustomMessageHandlers(XDocument.Parse(xmlText));

            messageHandlers1.Execute();
            Assert.AreEqual(messageHandlers1.GlobalMessageContext.GetHashCode(), messageHandlers2.GlobalMessageContext.GetHashCode());
        }
Exemple #7
0
        public void RestoreTest()
        {
            var messageHandlers = new CustomMessageHandlers(XDocument.Parse(xmlText));

            messageHandlers.Execute();
            Assert.IsTrue(messageHandlers.GlobalMessageContext.MessageCollection.Count > 0);
            messageHandlers.GlobalMessageContext.Restore();
            Assert.AreEqual(0, messageHandlers.GlobalMessageContext.MessageCollection.Count);
        }
Exemple #8
0
        public void DefaultResponseMessageTest()
        {
            var messageHandler = new CustomMessageHandlers(XDocument.Parse(xmlLocation));

            messageHandler.Execute();

            //TestMessageHandlers中没有处理坐标信息的重写方法,将返回默认消息


            Assert.IsInstanceOfType(messageHandler.ResponseMessage, typeof(ResponseMessageText));
            Assert.AreEqual("您发送的消息类型暂未被识别。", ((ResponseMessageText)messageHandler.ResponseMessage).Content);
        }
Exemple #9
0
        public void ContextTest()
        {
            var messageHandlers = new CustomMessageHandlers(XDocument.Parse(xmlText));

            messageHandlers.Execute();
            var messageContext = messageHandlers.GlobalMessageContext.GetMessageContext(messageHandlers.RequestMessage);

            Assert.IsTrue(messageContext.RequestMessages.Count > 0);
            Assert.IsNotNull(messageHandlers.CurrentMessageContext);
            Assert.AreEqual("olPjZjsXuQPJoV0HlruZkNzKc91E", messageHandlers.CurrentMessageContext.UserName);

            messageHandlers.GlobalMessageContext.ExpireMinutes = 0;//马上过期
            messageHandlers.Execute();
            messageContext = messageHandlers.GlobalMessageContext.GetMessageContext(messageHandlers.RequestMessage);
            Assert.AreEqual(0, messageContext.RequestMessages.Count);
        }
Exemple #10
0
        /// <summary>
        /// 微信认证事件测试
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="xml"></param>
        /// <param name="eventType"></param>
        /// <returns></returns>
        private CustomMessageHandlers VerifyEventTest <T>(string xml, Event eventType)
            where T : RequestMessageEventBase
        {
            var messageHandlers = new CustomMessageHandlers(XDocument.Parse(xml));

            Assert.IsNotNull(messageHandlers.RequestDocument);
            messageHandlers.Execute();
            Assert.IsNotNull(messageHandlers.TextResponseMessage);

            var requestMessage = messageHandlers.RequestMessage as T;

            Assert.IsNotNull(requestMessage);
            Assert.AreEqual(eventType, requestMessage.Event);

            return(messageHandlers);
        }
Exemple #11
0
        public void MutipleThreadsTest()
        {
            //
            var weixinContext = MessageHandler <MessageContext <IRequestMessageBase, IResponseMessageBase> > .GlobalWeixinContext;//全局共享的WeixinContext上下文对象

            weixinContext.Restore();

            //多线程并发写入测试
            List <Thread> threadList = new List <Thread>();

            for (int i = 0; i < 200; i++)
            {
                var testContext = new TestContext();
                var thread      = new Thread(testContext.Run);
                thread.Name = i.ToString();
                threadList.Add(thread);
            }

            threadList.ForEach(z => z.Start()); //开始所有线程

            while (TestContext.FinishCount < 200)
            {
            }

            Assert.AreEqual(200 * 10, weixinContext.MessageCollection.Count); //用户数量

            //判断消息上下是否自动移到底部
            {
                var userName = "******";

                var xml             = string.Format(TestContext.RequestXmlFormat, userName);
                var messageHandlers = new CustomMessageHandlers(XDocument.Parse(xml));
                messageHandlers.Execute();
                var lastQueueMessage = weixinContext.MessageQueue.Last();
                Assert.AreEqual(userName, lastQueueMessage.UserName);
            }

            //判断超时信息是否被及时删除
            {
                weixinContext.ExpireMinutes = 0.001;                       //设置过期时间(0.06秒)
                Thread.Sleep(100);
                weixinContext.GetLastRequestMessage("new");                //触发过期判断
                Assert.AreEqual(1, weixinContext.MessageCollection.Count); //只删除剩下当前这一个
            }
        }
        public void SendMenuTest()
        {
            var xml            = @"<?xml version=""1.0"" encoding=""utf-8""?>
<xml>
  <ToUserName><![CDATA[gh_a96a4a619366]]></ToUserName>
  <FromUserName><![CDATA[olPjZjsXuQPJoV0HlruZkNzKc91E]]></FromUserName>
  <CreateTime>1552115230</CreateTime>
  <MsgType><![CDATA[text]]></MsgType>
  <Content><![CDATA[满意]]></Content>
  <MsgId>22220946756594166</MsgId>
  <bizmsgmenuid>101</bizmsgmenuid>
</xml>";
            var messageHandler = new CustomMessageHandlers(XDocument.Parse(xml));

            messageHandler.Execute();
            Assert.IsInstanceOfType(messageHandler.ResponseMessage, typeof(ResponseMessageText));
            Assert.AreEqual("选择菜单:101,文字:满意", ((ResponseMessageText)messageHandler.ResponseMessage).Content);
        }
Exemple #13
0
            public void Run()
            {
                for (int i = 0; i < 10; i++)
                {
                    //模拟10个不同用户名
                    var userName = Thread.CurrentThread.Name + "_" + i;
                    var xml      = string.Format(RequestXmlFormat, userName);

                    for (int j = 0; j < 2; j++)
                    {
                        //每个用户请求2次
                        var messageHandlers = new CustomMessageHandlers(XDocument.Parse(xml));
                        messageHandlers.Execute();
                    }
                    Thread.Sleep(5);
                }
                TestContext.FinishCount++;
            }
        /// <summary>
        /// 事件测试
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="xml"></param>
        /// <param name="eventType"></param>
        /// <returns></returns>
        private CustomMessageHandlers VerifyEventTest <T>(string xml, Event eventType)
            where T : RequestMessageEventBase
        {
            var messageHandlers = new CustomMessageHandlers(XDocument.Parse(xml));

            Assert.IsNotNull(messageHandlers.RequestDocument);
            //messageHandlers.DefaultMessageHandlerAsyncEvent = NeuChar.MessageHandlers.DefaultMessageHandlerAsyncEvent.SelfSynicMethod;
            messageHandlers.Execute();
            Assert.IsNotNull(messageHandlers.TextResponseMessage);

            var requestMessage = messageHandlers.RequestMessage as T;

            Console.WriteLine(messageHandlers.RequestMessage.GetType());

            Assert.IsNotNull(requestMessage);
            Assert.AreEqual(eventType, requestMessage.Event);

            return(messageHandlers);
        }
Exemple #15
0
        public void TestConstructorTest()
        {
            var requestMessage = new RequestMessageText()
            {
                Content      = "Hi",
                CreateTime   = SystemTime.Now,
                FromUserName = "******",
                ToUserName   = "******",
                MsgId        = 123,
            };
            var messageHandler = new CustomMessageHandlers(requestMessage);

            messageHandler.Execute();

            //TestMessageHandlers中没有处理坐标信息的重写方法,将返回默认消息


            Assert.IsInstanceOfType(messageHandler.ResponseMessage, typeof(ResponseMessageText));
            Assert.AreEqual("文字信息", ((ResponseMessageText)messageHandler.ResponseMessage).Content);
        }
        public void TextMessageRequestTest()
        {
            var messageHandlers = new CustomMessageHandlers(XDocument.Parse(xmlText));

            Assert.IsNotNull(messageHandlers.RequestDocument);
            messageHandlers.Execute();
            Assert.IsNotNull(messageHandlers.ResponseMessage);
            Assert.IsNotNull(messageHandlers.ResponseDocument);
            Assert.IsFalse(messageHandlers.UsingEcryptMessage);                   //没有使用加密模式
            Assert.IsFalse(messageHandlers.UsingCompatibilityModelEcryptMessage); //没有加密模式,所以也没有兼容模式

            Console.Write(messageHandlers.ResponseDocument.ToString());

            Assert.AreEqual("gh_a96a4a619366", messageHandlers.ResponseMessage.FromUserName);

            var responseMessage = messageHandlers.ResponseMessage as ResponseMessageText;

            Assert.IsNotNull(responseMessage);
            Assert.AreEqual("文字信息", responseMessage.Content);
        }
Exemple #17
0
        public void RegexTest()
        {
            string regexXmlText   = @"<?xml version=""1.0"" encoding=""utf-8""?>
<xml>
    <ToUserName><![CDATA[gh_a96a4a619366]]></ToUserName>
    <FromUserName><![CDATA[olPjZjsXuQPJoV0HlruZkNzKc91E]]></FromUserName>
    <CreateTime>1357986928</CreateTime>
    <MsgType><![CDATA[text]]></MsgType>
    <Content><![CDATA[13987654321]]></Content>
    <MsgId>5832509444155992351</MsgId>
</xml>
";
            var    messageHandler = new CustomMessageHandlers(XDocument.Parse(regexXmlText));

            messageHandler.DefaultMessageHandlerAsyncEvent = NeuChar.MessageHandlers.DefaultMessageHandlerAsyncEvent.SelfSynicMethod;
            messageHandler.ExecuteAsync(new CancellationToken()).GetAwaiter().GetResult();
            Assert.IsNotNull(messageHandler.ResponseMessage);
            Assert.IsInstanceOfType(messageHandler.ResponseMessage, typeof(ResponseMessageText));
            Console.WriteLine(messageHandler.ResponseMessage.ToJson(true));
        }
Exemple #18
0
        public async Task PureEcryptMessageRequestTest()
        {
            //纯安全模式测试
            var ecryptXml = @"<?xml version=""1.0"" encoding=""utf-8""?>
<xml>
    <ToUserName><![CDATA[gh_a96a4a619366]]></ToUserName>
    <Encrypt><![CDATA[LasT9+F3u/TTDVh3wUdOXtaMF/uJe8kKvvzZ54avW/DU8pSuJFy815e2rAFBz8bHNK+271sLFLbwBLHr2BOAHS32irOMt8Pwza4tm6TU+C6zWS00SLeF1RPTCd2EyGawFu9jlYHkjxc9kX5PovDI6FoiPs3LcVU2kpu2wE/cdqHsVvt583C8ynagjq3DAh62B8E1Uz9I7lM56J6siW+m82OPFaRJfRSWO6pLuGj8LnBJp0sUah27jJ4COSYuc6VQaf/LaO2K5zDgXklDmDxw/6rQeY1gJLIRuoKLEVUOLaJN3UYTgEjJmAMd1vHbEF12Ex6YYxVRW280IWlLDixgLsvpBkrSUoqXAFmQfNcRJZf3Yr/MSGlpsoUVRfNP7iJ70OtzVU3lbKcMmnn5FbB0EHNzJJSBVM/XPLr9VD9Ac+g=]]></Encrypt>
</xml>
";
            var postModel = new PostModel()
            {
                Msg_Signature = "20f4a1263d198b696e6958e0d65e928aa68f7d96",
                Timestamp     = "1570032739",
                Nonce         = "2068872452",

                Token          = "weixin",
                EncodingAESKey = "mNnY5GekpChwqhy2c4NBH90g3hND6GeI4gii2YCvKLY",
                AppId          = "wx669ef95216eef885"
            };

            var messageHandlers = new CustomMessageHandlers(XDocument.Parse(ecryptXml), postModel);

            messageHandlers.DefaultMessageHandlerAsyncEvent = NeuChar.MessageHandlers.DefaultMessageHandlerAsyncEvent.SelfSynicMethod;
            messageHandlers.OmitRepeatedMessage             = false;//不去重

            Assert.IsNotNull(messageHandlers.RequestDocument);
            Assert.IsNotNull(messageHandlers.RequestMessage);
            Assert.IsNotNull(messageHandlers.RequestMessage.Encrypt);
            Assert.IsNotNull(messageHandlers.RequestMessage.FromUserName);
            Assert.IsNotNull(messageHandlers.EcryptRequestDocument);
            Assert.IsTrue(messageHandlers.UsingEcryptMessage);
            Assert.IsFalse(messageHandlers.UsingCompatibilityModelEcryptMessage);

            Console.WriteLine("RequestMessage:");
            Console.WriteLine(messageHandlers.RequestMessage.ToJson(true));

            await messageHandlers.ExecuteAsync(new CancellationToken());

            Console.WriteLine("ResponseMessage:");
            Console.WriteLine(messageHandlers.ResponseMessage.ToJson(true));
        }
Exemple #19
0
        public void OnEvent_MassSendJobFinishRequestTest()
        {
            var xml = @"<xml>
<ToUserName><![CDATA[gh_3e8adccde292]]></ToUserName>
<FromUserName><![CDATA[oR5Gjjl_eiZoUpGozMo7dbBJ362A]]></FromUserName>
<CreateTime>1394524295</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[MASSSENDJOBFINISH]]></Event>
<MsgID>1988</MsgID>
<Status><![CDATA[sendsuccess]]></Status>
<TotalCount>100</TotalCount>
<FilterCount>80</FilterCount>
<SentCount>75</SentCount>
<ErrorCount>5</ErrorCount>
</xml>";

            var messageHandlers = new CustomMessageHandlers(XDocument.Parse(xml));

            messageHandlers.Execute();
            Assert.IsNotNull(messageHandlers.ResponseMessage);
            Console.Write(messageHandlers.ResponseDocument);
        }
Exemple #20
0
        public void NeuCharReplyTest()
        {
            string xmlText         = @"<?xml version=""1.0"" encoding=""utf-8""?>
<xml>
    <ToUserName><![CDATA[gh_a96a4a619366]]></ToUserName>
    <FromUserName><![CDATA[olPjZjsXuQPJoV0HlruZkNzKc91E]]></FromUserName>
    <CreateTime>1357986928</CreateTime>
    <MsgType><![CDATA[text]]></MsgType>
    <Content><![CDATA[neuchar]]></Content>
    <MsgId>5832509444155992350</MsgId>
</xml>
";
            var    messageHandlers = new CustomMessageHandlers(XDocument.Parse(xmlText));

            Assert.IsNotNull(messageHandlers.RequestDocument);
            messageHandlers.Execute();
            Assert.IsNotNull(messageHandlers.ResponseMessage);
            Assert.IsNotNull(messageHandlers.ResponseDocument);
            Assert.IsFalse(messageHandlers.UsingEcryptMessage);                   //没有使用加密模式
            Assert.IsFalse(messageHandlers.UsingCompatibilityModelEcryptMessage); //没有加密模式,所以也没有兼容模式

            Console.Write(messageHandlers.ResponseDocument.ToString());
        }
Exemple #21
0
        public void NeuCharDefineTest()
        {
            string xmlText         = @"<xml>
  <ToUserName>Senparc</ToUserName>
  <FromUserName>NeuChar</FromUserName>
  <CreateTime>1537966819</CreateTime>
  <MsgType>NeuChar</MsgType>
  <MsgId>636735924194707412</MsgId>
  <NeuCharMessageType>SaveConfig</NeuCharMessageType>
  <ConfigRoot><![CDATA[{
  ""version"": ""0.0.1"",
  ""name"": ""NeuChar"",
  ""guid"": ""9F88AF01CC084F658DDD31F022B18053"",
  ""key"": """",
  ""Configs"": {
                ""Version"": ""0.0.1"",
    ""MaterialData"": [
      {
        ""Name"": ""2d71a392-6055-425d-9433-cf3d88d3e0d6"",
        ""Id"": ""2d71a392-6055-425d-9433-cf3d88d3e0d6"",
        ""Note"": null,
        ""Version"": ""20180926"",
        ""Type"": 1,
        ""Content"": ""Test""
      }
    ],
    ""Config"": {
      ""MessagePair"": [
        {
          ""Name"": ""规则一"",
          ""Id"": null,
          ""Note"": null,
          ""Version"": ""20180926"",
          ""Request"": {
            ""Type"": 0,
            ""Keywords"": [
              ""1""
            ]
},
          ""Responses"": [
            {
              ""Type"": 1,
              ""MaterialId"": ""2d71a392-6055-425d-9433-cf3d88d3e0d6""
            }
          ]
        }
      ]
    },
    ""Name"": ""MessageHandlerNode"",
    ""ChildrenNodes"": []
  }
}]]></ConfigRoot>
</xml>
";
            var    messageHandlers = new CustomMessageHandlers(XDocument.Parse(xmlText));

            Assert.IsNotNull(messageHandlers.RequestDocument);
            messageHandlers.Execute();
            Assert.IsNull(messageHandlers.ResponseMessage);
            Assert.IsNull(messageHandlers.ResponseDocument);
            Assert.IsFalse(messageHandlers.UsingEcryptMessage);                   //没有使用加密模式
            Assert.IsFalse(messageHandlers.UsingCompatibilityModelEcryptMessage); //没有加密模式,所以也没有兼容模式

            Console.Write(messageHandlers.TextResponseMessage);
        }