/Senparc.Weixin.MP/Senparc.Weixin.MP.Test/Exceptions/WeixinExceptionTest.cs
C# | 39 lines | 37 code | 2 blank | 0 comment | 0 complexity | f6a96d76e1f22a248d6a472a53667681 MD5 | raw file
Possible License(s): BSD-2-Clause, BSD-3-Clause
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Xml.Linq;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- namespace Senparc.Weixin.MP.Test
- {
- [TestClass]
- public class WeixinExceptionTest
- {
- string xmlText = @"<?xml version=""1.0"" encoding=""utf-8""?>
- <xml>
- <ToUserName><![CDATA[gh_a96a4a619366]]></ToUserName>
- <FromUserName><![CDATA[olPjZjsXuQPJoV0HlruZkNzKc91E]]></FromUserName>
- <CreateTime>1357986928</CreateTime>
- <MsgType><![CDATA[UNKNOWN]]></MsgType>
- <Content><![CDATA[TNT2]]></Content>
- <MsgId>5832509444155992350</MsgId>
- </xml>
- ";
- [TestMethod]
- public void ThrowTest()
- {
- WeixinException unkonwnException = null;
- try
- {
- var response = MP.RequestMessageFactory.GetRequestEntity(xmlText);
- }
- catch (WeixinException ex)
- {
- unkonwnException = ex;
- }
- Assert.IsNotNull(unkonwnException);
- }
- }
- }