From 503e2e06eddb0578165d754cb133c8fa2d7a379f Mon Sep 17 00:00:00 2001 From: ConanYao Date: Sat, 2 Dec 2023 05:50:43 +0800 Subject: [PATCH] update TestMethod --- .../CommonApis/CommonJsonSendTests.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Senparc.Weixin.MP/Senparc.WeixinTests/CommonApis/CommonJsonSendTests.cs b/src/Senparc.Weixin.MP/Senparc.WeixinTests/CommonApis/CommonJsonSendTests.cs index 57b4e0c3f0..2a7004f30a 100644 --- a/src/Senparc.Weixin.MP/Senparc.WeixinTests/CommonApis/CommonJsonSendTests.cs +++ b/src/Senparc.Weixin.MP/Senparc.WeixinTests/CommonApis/CommonJsonSendTests.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; +using Senparc.Weixin.MP; using Senparc.Weixin.MP.CommonAPIs; using System; using System.Collections.Generic; @@ -45,7 +46,23 @@ public void GetCurrentSelfMenuInfoTest() { Assert.IsTrue(true); } - Assert.IsTrue(false); + else + { + Assert.IsTrue(false); + } + + string json = "{\"is_menu_open\":1,\"selfmenu_info\":{\"button\":[{\"type\":\"click\",\"name\":\"今日歌曲\",\"key\":\"V1001_TODAY_MUSIC\"},{\"name\":\"菜单\",\"sub_button\":{\"list\":[{\"type\":\"view\",\"name\":\"搜索\",\"url\":\"http:\\/\\/www.soso.com\\/\"},{\"type\":\"click\",\"name\":\"赞一下我们\",\"key\":\"V1001_GOOD\"}]}}]}}"; + try + { + var test = Newtonsoft.Json.JsonConvert.DeserializeObject(json); + Console.WriteLine(test); + Assert.IsTrue(true); + } + catch (Exception) + { + Assert.IsTrue(false); + throw; + } } } }