test: 增加提醒测试

oneRain 2020-04-28 14:49:00 +08:00
parent c3fbf36971
commit cce620724a
1 changed files with 37 additions and 0 deletions

View File

@ -2,6 +2,7 @@
using System;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using System.Collections.Generic;
using LeanCloud;
using LeanCloud.Common;
using LeanCloud.Storage;
@ -230,5 +231,41 @@ namespace Realtime.Test {
await tcs.Task;
}
[Test]
[Order(8)]
public async Task MentionList() {
TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
m2.OnMessage = (conv, msg) => {
Assert.True(msg.Mentioned);
Assert.True(msg.MentionIdList.Contains(m2.Id));
tcs.SetResult(null);
};
LCIMTextMessage textMessage = new LCIMTextMessage("hello") {
MentionIdList = new List<string> { m2.Id }
};
await conversation.Send(textMessage);
await tcs.Task;
}
[Test]
[Order(9)]
public async Task MentionAll() {
TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
m2.OnMessage = (conv, msg) => {
Assert.True(msg.Mentioned);
Assert.True(msg.MentionAll);
tcs.SetResult(null);
};
LCIMTextMessage textMessage = new LCIMTextMessage("world") {
MentionAll = true
};
await conversation.Send(textMessage);
await tcs.Task;
}
}
}