PageRenderTime 55ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/Senparc.Weixin.MP/Senparc.Weixin.MP.Test/Exceptions/WeixinExceptionTest.cs

https://github.com/mjhuangzk/WeiXinMPSDK
C# | 39 lines | 37 code | 2 blank | 0 comment | 0 complexity | f6a96d76e1f22a248d6a472a53667681 MD5 | raw file
Possible License(s): BSD-2-Clause, BSD-3-Clause
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Xml.Linq;
  6. using Microsoft.VisualStudio.TestTools.UnitTesting;
  7. namespace Senparc.Weixin.MP.Test
  8. {
  9. [TestClass]
  10. public class WeixinExceptionTest
  11. {
  12. string xmlText = @"<?xml version=""1.0"" encoding=""utf-8""?>
  13. <xml>
  14. <ToUserName><![CDATA[gh_a96a4a619366]]></ToUserName>
  15. <FromUserName><![CDATA[olPjZjsXuQPJoV0HlruZkNzKc91E]]></FromUserName>
  16. <CreateTime>1357986928</CreateTime>
  17. <MsgType><![CDATA[UNKNOWN]]></MsgType>
  18. <Content><![CDATA[TNT2]]></Content>
  19. <MsgId>5832509444155992350</MsgId>
  20. </xml>
  21. ";
  22. [TestMethod]
  23. public void ThrowTest()
  24. {
  25. WeixinException unkonwnException = null;
  26. try
  27. {
  28. var response = MP.RequestMessageFactory.GetRequestEntity(xmlText);
  29. }
  30. catch (WeixinException ex)
  31. {
  32. unkonwnException = ex;
  33. }
  34. Assert.IsNotNull(unkonwnException);
  35. }
  36. }
  37. }