public void MenuApiTest_AddConditional() { var menuJson = "{\"button\":[{\"type\":\"click\",\"name\":\"今日歌曲\",\"key\":\"V1001_TODAY_MUSIC\"},{\"name\":\"菜单\",\"sub_button\":[{\"type\":\"view\",\"name\":\"搜索\",\"url\":\"http://www.soso.com/\"},{\"type\":\"view\",\"name\":\"视频\",\"url\":\"http://v.qq.com/\"},{\"type\":\"click\",\"name\":\"赞一下我们\",\"key\":\"V1001_GOOD\"}]}],\"matchrule\":{\"group_id\":\"2\",\"sex\":\"1\",\"country\":\"中国\",\"province\":\"广东\",\"city\":\"广州\",\"client_platform_type\":\"2\",\"language\":\"zh_CN\"}}"; var conditionalMenuInfo = JsonConvert.DeserializeObject <ConditionalMenuInfo>(menuJson); var result = weChatApi.AddConditional(conditionalMenuInfo); if (!result.IsSuccess()) { Assert.Fail("创建个性化菜单数据失败,返回结果如下:" + result.DetailResult); } }