Ejemplo n.º 1
0
        public void NewsApiTest_Post()
        {
            //不能使用第三方的图片
            var model = new NewsPostModel
            {
                Articles = new List <NewsPostModel.ArticleInfo>
                {
                    new NewsPostModel.ArticleInfo
                    {
                        Author  = "liwq",
                        Content =
                            "<p><img data-s=\"300,640\" data-type=\"png\" data-src=\"http://mmbiz.qpic.cn/mmbiz/SLeRFiaVmNAS3kOq3icjbfpz1GicHibTN4P9jicick8xyiaia8TMEzafuB4dSBfba5IdshdYX2qXJqBP689NMhPHuo3PsQ/0?wx_fmt=png\" data-ratio=\"0.7733812949640287\" data-w=\"\"  /><br  /></p><p><span style=\"line-height: 25.6px;\">“Magicodes.WeiChat,是由Magicode.WeiChat团队打造的一个基于ASP.NET &nbsp; MVC5微信业务快速开发与定制的开发框架。目的让微信业务开发与定制更快速、简单。”</span></p>",
                        ContentSourceUrl = "http://www.cnblogs.com/codelove/p/5306395.html",
                        Digest           = "每周一小更,每月一大更。我们要做最好的微信快速定制开发框架。",
                        ShowCoverPic     = 0,
                        ThumbMediaId     = "HXIy1CJD5Qt12D9XBuSx0pXEqWaCbkwdYwCQ50spLlE",
                        Title            = "版本历史"
                    },
                    new NewsPostModel.ArticleInfo
                    {
                        Author  = "liwq",
                        Content =
                            "<p><img data-s=\"300,640\" data-type=\"png\" data-src=\"http://mmbiz.qpic.cn/mmbiz/SLeRFiaVmNAS3kOq3icjbfpz1GicHibTN4P9jicick8xyiaia8TMEzafuB4dSBfba5IdshdYX2qXJqBP689NMhPHuo3PsQ/0?wx_fmt=png\" data-ratio=\"0.7733812949640287\" data-w=\"\"  /><br  /></p><p><span style=\"line-height: 25.6px;\">“Magicodes.WeiChat,是由Magicode.WeiChat团队打造的一个基于ASP.NET &nbsp; MVC5微信业务快速开发与定制的开发框架。目的让微信业务开发与定制更快速、简单。”</span></p>",
                        ContentSourceUrl = "http://www.cnblogs.com/codelove/p/5306395.html",
                        Digest           = "每周一小更,每月一大更。我们要做最好的微信快速定制开发框架。",
                        ShowCoverPic     = 0,
                        ThumbMediaId     = "HXIy1CJD5Qt12D9XBuSx0pXEqWaCbkwdYwCQ50spLlE",
                        Title            = "版本历史"
                    },
                    new NewsPostModel.ArticleInfo
                    {
                        Author  = "liwq",
                        Content =
                            "<div><img src=\"http://mmbiz.qpic.cn/mmbiz/SLeRFiaVmNAS3kOq3icjbfpz1GicHibTN4P9jicick8xyiaia8TMEzafuB4dSBfba5IdshdYX2qXJqBP689NMhPHuo3PsQ/0?wx_fmt=png\" /></div>",
                        ContentSourceUrl = "http://www.cnblogs.com/codelove/p/5306395.html",
                        Digest           = "每周一小更,每月一大更。我们要做最好的微信快速定制开发框架。",
                        ShowCoverPic     = 0,
                        ThumbMediaId     = "HXIy1CJD5Qt12D9XBuSx0pXEqWaCbkwdYwCQ50spLlE",
                        Title            = "版本历史"
                    },
                    new NewsPostModel.ArticleInfo
                    {
                        Author  = "liwq",
                        Content =
                            "<div><img src=\"http://mmbiz.qpic.cn/mmbiz/SLeRFiaVmNAS3kOq3icjbfpz1GicHibTN4P9jicick8xyiaia8TMEzafuB4dSBfba5IdshdYX2qXJqBP689NMhPHuo3PsQ/0?wx_fmt=png\" /></div>",
                        ContentSourceUrl = "http://www.cnblogs.com/codelove/p/5306395.html",
                        Digest           = "每周一小更,每月一大更。我们要做最好的微信快速定制开发框架。",
                        ShowCoverPic     = 0,
                        ThumbMediaId     = "HXIy1CJD5Qt12D9XBuSx0pXEqWaCbkwdYwCQ50spLlE",
                        Title            = "版本历史"
                    }
                }
            };
            var result = api.Post(model);

            if (!result.IsSuccess())
            {
                Assert.Fail("添加多图文信息失败,返回结果如下:" + result.DetailResult);
            }
        }