示例#1
0
		private void HandleShowComment(dynamic json) {
			if (this.OnShowComment != null) {
				var message = new Message(json);
				this.OnShowComment(message);
			}
		}
示例#2
0
		private void HandleUnBanUser(dynamic json) {
			if (this.OnUnBan != null) {
				var message = new Message(json);
				this.OnUnBan(message);
			}
		}
示例#3
0
		private void HandlePostComment(dynamic json) {
			if (this.OnNewMessage != null) {
				var post = new Message(json);
				this.OnNewMessage(post);
			}
		}
示例#4
0
		private void HandleBanUser(dynamic json) {
			if (this.OnBan != null) {
				var message = new Message(json);
				message.IsBan = true;
				this.OnBan(message);
			}
		}
示例#5
0
		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));
		}