using Microsoft.VisualStudio.TestTools.UnitTesting; using Senparc.Weixin.MP.Entities; using Senparc.Weixin.MP.Test.NetCore3.MessageHandlers.TestEntities; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml.Linq; namespace Senparc.Weixin.MP.Test.MessageHandlers { public partial class MessageHandlersTest { [TestMethod] public void RenderResponseMessageNewsTest() { var xmlText = @" 1539684529 "; var messageHandler = VerifyEventTest(xmlText, Event.CLICK); messageHandler.Execute(); Assert.IsNotNull(messageHandler.TextResponseMessage); Console.WriteLine(messageHandler.TextResponseMessage); } [TestMethod] public void SendMenuTest() { var xml = @" 1552115230 22220946756594166 101 "; var messageHandler = new CustomMessageHandlers(XDocument.Parse(xml)); messageHandler.Execute(); Assert.IsInstanceOfType(messageHandler.ResponseMessage, typeof(ResponseMessageText)); Assert.AreEqual("选择菜单:101,文字:满意", ((ResponseMessageText)messageHandler.ResponseMessage).Content); } } }