private void HandleShowComment(dynamic json) { if (this.OnShowComment != null) { var message = new Message(json); this.OnShowComment(message); } }
private void HandleUnBanUser(dynamic json) { if (this.OnUnBan != null) { var message = new Message(json); this.OnUnBan(message); } }
private void HandlePostComment(dynamic json) { if (this.OnNewMessage != null) { var post = new Message(json); this.OnNewMessage(post); } }
private void HandleBanUser(dynamic json) { if (this.OnBan != null) { var message = new Message(json); message.IsBan = true; this.OnBan(message); } }
public void ParseMessage_正常() { // arrange var time = new DateTime(2000, 1, 1); var message1 = this.CreateMessage(1, "", "hoge", "comment", time, true, false); var message2 = this.CreateMessage(1, "", "fuga", "comment", time, true, false); var message3 = this.CreateMessage(1, "", "piyo", "comment", time, true, false); var list = new Message[] { message1, message2, message3 }; var jsonString = DynamicJson_Accessor.Serialize(new { comments = list.Select(item => new { comment_num = item.Number, message = item.Comment, html = "", name = item.Name, time = JavaScriptTime_Accessor.ToDouble(item.PostTime, TimeZoneKind.Japan), is_ban = item.IsBan, auth = item.IsAuth, }), }); // act var actual = target.ParseMessage(jsonString); // assert Assert.AreEqual(message1, actual.ElementAt(0)); Assert.AreEqual(message2, actual.ElementAt(1)); Assert.AreEqual(message3, actual.ElementAt(2)); }