#region Apache License Version 2.0
/*----------------------------------------------------------------
Copyright 2022 Jeffrey Su & Suzhou Senparc Network Technology Co.,Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language governing permissions
and limitations under the License.
Detail: https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md
----------------------------------------------------------------*/
#endregion Apache License Version 2.0
using System;
using System.Linq;
using System.Xml.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Senparc.CO2NET.Helpers;
using Senparc.Weixin.MP.Entities;
namespace Senparc.Weixin.MP.Test
{
[TestClass]
public class RequestMessageFactoryTest
{
string xmlText = @"
1357986928
5832509444155992350
";
string xmlLocation = @"
1358061152
31.285774
120.597610
19
5832828233808572154
";
private string xmlImage = @"
1358061658
5832830407062023950
";
private string xmlVoice = @"
1361430302
5847298622973403529
";
private string xmlVideo = @"
1361430302
";
private string xmlShortVideo = @"
1357290913
1234567890123456
";
// @"
//
//
//
// 1361430302
//
//
//";
private string xmlLink = @"
1351776360
1234567890123456
";
private string xmlEvent_Enter = @"
123456789
";
private string xmlEvent_Location = @"
123456789
23.137466
113.352425
119.385040
";
private string xmlEvent_Subscribe = @"
1364447046
";
private string xmlEvent_Unsubscribe = @"
1364447020
";
private string xmlEvent_Click = @"
1364447020
";
private string xmlEvent_Scan = @"
1364447020
";
private string xmlEvent_View = @"
1394805110
";
private string xmlEvent_Scancode_Push = @"
1408090502
";
private string xmlEvent_Scancode_Waitmsg = @"
1408090606
";
private string xmlEvent_Pic_Sysphoto = @"
1408090651
1
-
";
private string xmlEvent_Pic_Photo_Or_Album = @"
1408090816
1
-
-
";
private string xmlEvent_Pic_Weixin = @"
1408090816
1
-
";
private string xmlEvent_Location_Select = @"
1408091189
";
private string xmlEvent_MassSendJobFinish = @"
1394524295
1988
100
80
75
5
";
private string xmlEvent_Card_Pass_Check = @"
123456789
//不通过为card_not_pass_check
";
private string xmlEvent_Card_Not_Pass_Check=@"
123456789
//不通过为card_not_pass_check
";
private string xmlEvent_User_Get_Card = @"
123456789
1
";
private string xmlEvent_User_Del_Card = @"
123456789
";
private string xmlEvent_Kf_Create_Session = @"
1399197672
";
private string xmlEvent_Kf_Close_Session = @"
1399197672
";
private string xmlEvent_Kf_Switch_Session = @"
1399197672
";
private string xmlEvent_Poi_Check_Notify = @"
1408622107
";
private string xmlEvent_WifiConnected = @"
123456789
0
0
";
private string xmlEvent_User_Consume_Card = @"
123456789
";
private string xmlEvent_User_Enter_Session_From_Card = @"
123456789
";
private string xmlEvent_User_View_Card = @"
123456789
";
private string xmlEvent_Merchant_Order = @"
1398144192
2
";
private string xmlEvent_Submit_Membercard_User_Info = @"
1432668700
";
private string xmlEvent_ShakearoundUserShake = @"
1433332012
12345
54321
0.057
12345
54321
166.816
12345
54321
15.013
";
private string xmlEvent_Modify_Store_Audit_Info = @"
1488856741
11111
3
";
private string xmlEvent_Add_Store_Audit_Info = @"
1488856741
11111
3
3
12344
";
private string xmlEvent_Create_Map_Poi_Audit_Info = @"
1488856741
11111
1
";
private string xmlEvent_Apply_Merchant_Audit_InfoRequest = @"
1488856741
11111
3
";
[TestMethod]
public void GetRequestEntityTest()
{
var dt = DateTimeHelper.BaseTime.AddTicks(((long)1358061152 + 8 * 60 * 60) * 10000000);
{
//Text
var doc = XDocument.Parse(xmlText);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc);
Assert.IsInstanceOfType(result, typeof(RequestMessageText));
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual("TNT2", (result as RequestMessageText).Content);
}
{
//Location
var doc = XDocument.Parse(xmlLocation);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageLocation;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual(19, result.Scale);
}
{
//Image
var doc = XDocument.Parse(xmlImage);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageImage;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual("http://mmsns.qpic.cn/mmsns/ZxBXNzgHyUqazGkXUvujSPxexzynJAicf440qkyLibBd1OEO4saJiavLQ/0", result.PicUrl);
}
{
//Voice
var doc = XDocument.Parse(xmlVoice);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageVoice;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual("X1yfgB2XI-faU6R2jmKz0X1JZmPCxIvM-9ktt4K92BB9577SCi41S-qMl60q5DJo", result.MediaId);
}
{
//Video
var doc = XDocument.Parse(xmlVideo);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageVideo;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual("mediaId", result.MediaId);
Assert.AreEqual("thumbMediaId", result.ThumbMediaId);
}
{
//ShortVideo
var doc = XDocument.Parse(xmlShortVideo);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageShortVideo;
Assert.IsNotNull(result);
Assert.AreEqual("toUser", result.ToUserName);
Assert.AreEqual("media_id", result.MediaId);
Assert.AreEqual("thumb_media_id", result.ThumbMediaId);
}
{
//Link
var doc = XDocument.Parse(xmlLink);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageLink;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual("公众平台官网链接", result.Title);
Assert.AreEqual("Senparc.Weixin.MP SDK公众平台官网链接", result.Description);
Assert.AreEqual("https://sdk.weixin.senparc.com", result.Url);
}
{
//Event-ENTRY
var doc = XDocument.Parse(xmlEvent_Enter);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Enter;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual(Event.ENTER, result.Event);
}
{
//Event-Location
var doc = XDocument.Parse(xmlEvent_Location);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Location;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual(Event.LOCATION, result.Event);
Assert.AreEqual(23.137466, result.Latitude);
Assert.AreEqual(113.352425, result.Longitude);
Assert.AreEqual(119.385040, result.Precision);
}
{
//Event-Subscribe
var doc = XDocument.Parse(xmlEvent_Subscribe);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Subscribe;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual(Event.subscribe, result.Event);
}
{
//Event-Unsubscribe
var doc = XDocument.Parse(xmlEvent_Unsubscribe);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Unsubscribe;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual(Event.unsubscribe, result.Event);
Assert.AreEqual(new DateTime(2013, 3, 28), result.CreateTime.Date);
}
{
//Event-CLICK
var doc = XDocument.Parse(xmlEvent_Click);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Click;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual(Event.CLICK, result.Event);
Assert.AreEqual(new DateTime(2013, 3, 28), result.CreateTime.Date);
Assert.AreEqual("SubClickRoot_Agent", result.EventKey);
}
{
//Event-scan
var doc = XDocument.Parse(xmlEvent_Scan);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Scan;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual(Event.scan, result.Event);
Assert.AreEqual(new DateTime(2013, 3, 28), result.CreateTime.Date);
Assert.AreEqual("SCENE_VALUE", result.EventKey);
Assert.AreEqual("TICKET", result.Ticket);
}
{
//Event-VIEW
var doc = XDocument.Parse(xmlEvent_View);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_View;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual(Event.VIEW, result.Event);
Assert.AreEqual(new DateTime(2014, 3, 14), result.CreateTime.Date);
Assert.AreEqual("https://sdk.weixin.senparc.com", result.EventKey);
}
{
//Event-Scancode_Push
var doc = XDocument.Parse(xmlEvent_Scancode_Push);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Scancode_Push;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual(Event.scancode_push, result.Event);
Assert.IsNotNull(result.ScanCodeInfo.ScanResult);
}
{
//Event-Scancode_Scancode_Waitmsg
var doc = XDocument.Parse(xmlEvent_Scancode_Waitmsg);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Scancode_Waitmsg;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual(Event.scancode_waitmsg, result.Event);
Assert.IsNotNull(result.ScanCodeInfo.ScanResult);
}
{
//Event-Scancode_Pic_Sysphoto
var doc = XDocument.Parse(xmlEvent_Pic_Sysphoto);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Pic_Sysphoto;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual(Event.pic_sysphoto, result.Event);
Assert.IsNotNull(result.SendPicsInfo.PicList);
}
{
//Event-Scancode_Pic_Photo_Or_Album
var doc = XDocument.Parse(xmlEvent_Pic_Photo_Or_Album);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Pic_Photo_Or_Album;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual(Event.pic_photo_or_album, result.Event);
Assert.IsNotNull(result.SendPicsInfo.PicList);
}
{
//Event-Scancode_Pic_Weixin
var doc = XDocument.Parse(xmlEvent_Pic_Weixin);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Pic_Weixin;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual(Event.pic_weixin, result.Event);
Assert.IsNotNull(result.SendPicsInfo.PicList);
}
{
//Event-Location_Select
var doc = XDocument.Parse(xmlEvent_Location_Select);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Location_Select;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual(Event.location_select, result.Event);
Assert.IsNotNull(result.SendLocationInfo.Location_X);
}
{
//Event-MassSendJobFinish
var doc = XDocument.Parse(xmlEvent_MassSendJobFinish);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_MassSendJobFinish;
Assert.IsNotNull(result);
Assert.AreEqual("gh_a96a4a619366", result.ToUserName);
Assert.AreEqual(Event.MASSSENDJOBFINISH, result.Event);
Assert.AreEqual(result.SentCount, 75);
Assert.AreEqual(result.ErrorCount, 5);
Assert.IsNotNull(result.MsgID);
Assert.AreEqual(1988, result.MsgID);
}
{
//Event-Card_Pass_Check
var doc = XDocument.Parse(xmlEvent_Card_Pass_Check);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Card_Pass_Check;
Assert.IsNotNull(result);
Assert.AreEqual("toUser", result.ToUserName);
Assert.AreEqual(Event.card_pass_check, result.Event);
Assert.IsNotNull(result.CardId);
Assert.AreEqual("cardid", result.CardId);
}
{
//Event-Card_Not_Pass_Check
var doc = XDocument.Parse(xmlEvent_Card_Not_Pass_Check);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Card_Not_Pass_Check;
Assert.IsNotNull(result);
Assert.AreEqual("toUser", result.ToUserName);
Assert.AreEqual(Event.card_not_pass_check, result.Event);
Assert.IsNotNull(result.CardId);
Assert.AreEqual("cardid", result.CardId);
}
{
//Event-User_Get_Card
var doc = XDocument.Parse(xmlEvent_User_Get_Card);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_User_Get_Card;
Assert.IsNotNull(result);
Assert.AreEqual("toUser", result.ToUserName);
Assert.AreEqual(Event.user_get_card, result.Event);
Assert.IsNotNull(result.CardId);
Assert.AreEqual(1, result.IsGiveByFriend);
}
{
//Event-User_Del_Card
var doc = XDocument.Parse(xmlEvent_User_Del_Card);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_User_Del_Card;
Assert.IsNotNull(result);
Assert.AreEqual("toUser", result.ToUserName);
Assert.AreEqual(Event.user_del_card, result.Event);
Assert.IsNotNull(result.CardId);
Assert.AreEqual("12312312", result.UserCardCode);
}
{
//Event-Kf_Create_Session
var doc = XDocument.Parse(xmlEvent_Kf_Create_Session);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Kf_Create_Session;
Assert.IsNotNull(result);
Assert.AreEqual("touser", result.ToUserName);
Assert.AreEqual(Event.kf_create_session, result.Event);
Assert.AreEqual("test1@test", result.KfAccount);
}
{
//Event-Kf_Close_Session
var doc = XDocument.Parse(xmlEvent_Kf_Close_Session);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Kf_Close_Session;
Assert.IsNotNull(result);
Assert.AreEqual("touser", result.ToUserName);
Assert.AreEqual(Event.kf_close_session, result.Event);
Assert.AreEqual("test1@test", result.KfAccount);
}
{
//Event-Kf_Switch_Session
var doc = XDocument.Parse(xmlEvent_Kf_Switch_Session);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Kf_Switch_Session;
Assert.IsNotNull(result);
Assert.AreEqual("touser", result.ToUserName);
Assert.AreEqual(Event.kf_switch_session, result.Event);
Assert.AreEqual("test1@test", result.FromKfAccount);
Assert.AreEqual("test2@test", result.ToKfAccount);
}
{
//Event-Poi_Check_Notify
var doc = XDocument.Parse(xmlEvent_Poi_Check_Notify);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Poi_Check_Notify;
Assert.IsNotNull(result);
Assert.AreEqual("toUser", result.ToUserName);
Assert.AreEqual(Event.poi_check_notify, result.Event);
Assert.AreEqual("123adb", result.UniqId);
Assert.AreEqual("fail", result.Result);
}
{
//Event-WifiConnected
var doc = XDocument.Parse(xmlEvent_WifiConnected);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_WifiConnected;
Assert.IsNotNull(result);
Assert.AreEqual("toUser", result.ToUserName);
Assert.AreEqual(Event.WifiConnected, result.Event);
Assert.AreEqual("PlaceId", result.PlaceId);
Assert.AreEqual("3001224419", result.VendorId);
}
{
//Event-User_Consume_Card
var doc = XDocument.Parse(xmlEvent_User_Consume_Card);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_User_Consume_Card;
Assert.IsNotNull(result);
Assert.AreEqual("toUser", result.ToUserName);
Assert.AreEqual(Event.user_consume_card, result.Event);
Assert.AreEqual("cardid", result.CardId);
}
{
//Event-User_Enter_Session_From_Card
var doc = XDocument.Parse(xmlEvent_User_Enter_Session_From_Card);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_User_Enter_Session_From_Card;
Assert.IsNotNull(result);
Assert.AreEqual("toUser", result.ToUserName);
Assert.AreEqual(Event.user_enter_session_from_card, result.Event);
Assert.AreEqual("cardid", result.CardId);
}
{
//Event-User_View_Card
var doc = XDocument.Parse(xmlEvent_User_View_Card);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_User_View_Card;
Assert.IsNotNull(result);
Assert.AreEqual("toUser", result.ToUserName);
Assert.AreEqual(Event.user_view_card, result.Event);
Assert.AreEqual("cardid", result.CardId);
}
{
//Event-Merchant_Order
var doc = XDocument.Parse(xmlEvent_Merchant_Order);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Merchant_Order;
Assert.IsNotNull(result);
Assert.AreEqual("weixin_media1", result.ToUserName);
Assert.AreEqual(Event.merchant_order, result.Event);
Assert.AreEqual("test_product_id", result.ProductId);
}
{
//Event-Submit_Membercard_User_Info
var doc = XDocument.Parse(xmlEvent_Submit_Membercard_User_Info);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_Submit_Membercard_User_Info;
Assert.IsNotNull(result);
Assert.AreEqual("gh_3fcea188bf78", result.ToUserName);
Assert.AreEqual(Event.submit_membercard_user_info, result.Event);
Assert.AreEqual("pbLatjtZ7v1BG_ZnTjbW85GYc_E8", result.CardId);
}
{
//Event-ShakearoundUserShake
var doc = XDocument.Parse(xmlEvent_ShakearoundUserShake);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_ShakearoundUserShake;
Assert.IsNotNull(result);
Assert.AreEqual("toUser", result.ToUserName);
Assert.AreEqual(Event.ShakearoundUserShake, result.Event);
Assert.AreEqual(12345, result.ChosenBeacon.Major);
Assert.AreEqual(54321, result.ChosenBeacon.Minor);
Assert.AreEqual(2, result.AroundBeacons.Count);
Assert.AreEqual(15.013, result.AroundBeacons.ElementAt(1).Distance);
}
{
//Event-Apply_Merchant_Audit_InfoRequest
var doc = XDocument.Parse(xmlEvent_Apply_Merchant_Audit_InfoRequest);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_ApplyMerchantAuditInfo;
Assert.IsNotNull(result);
Assert.AreEqual("gh_4346ac1514d8", result.ToUserName);
Assert.AreEqual(Event.apply_merchant_audit_info, result.Event);
Assert.AreEqual(11111, result.audit_id);
Assert.AreEqual(3, result.status);
Assert.AreEqual("xxx", result.reason);
}
{
//Event-Apply_CreateMapPoiAuditInfo
var doc = XDocument.Parse(xmlEvent_Create_Map_Poi_Audit_Info);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_CreateMapPoiAuditInfo;
Assert.IsNotNull(result);
Assert.AreEqual("gh_4346ac1514d8", result.ToUserName);
Assert.AreEqual(Event.create_map_poi_audit_info, result.Event);
Assert.AreEqual(11111, result.audit_id);
Assert.AreEqual(1, result.status);
Assert.AreEqual("xxx", result.map_poi_id);
Assert.AreEqual("xxx", result.name);
Assert.AreEqual("xxx", result.address);
Assert.AreEqual(134, result.latitude);
Assert.AreEqual(30, result.longitude);
Assert.AreEqual("xxx", result.sh_remark);
}
{
//Event-Apply_AddStoreAuditInfo
var doc = XDocument.Parse(xmlEvent_Add_Store_Audit_Info);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_AddStoreAuditInfo;
Assert.IsNotNull(result);
Assert.AreEqual("gh_4346ac1514d8", result.ToUserName);
Assert.AreEqual(Event.add_store_audit_info, result.Event);
Assert.AreEqual(11111, result.audit_id);
Assert.AreEqual(3, result.is_upgrade);
Assert.AreEqual("12344", result.poiid);
Assert.AreEqual(3, result.status);
Assert.AreEqual("xxx", result.reason);
}
{
//Event-Apply_AddStoreAuditInfo
var doc = XDocument.Parse(xmlEvent_Modify_Store_Audit_Info);
var result = RequestMessageFactory.GetRequestEntity(new MessageContexts.DefaultMpMessageContext(), doc) as RequestMessageEvent_ModifyStoreAuditInfo;
Assert.IsNotNull(result);
Assert.AreEqual("gh_4346ac1514d8", result.ToUserName);
Assert.AreEqual(Event.modify_store_audit_info, result.Event);
Assert.AreEqual(11111, result.audit_id);
Assert.AreEqual(3, result.status);
Assert.AreEqual("xxx", result.reason);
}
}
}
}