chore: 调整命名空间

oneRain 2020-04-28 17:04:46 +08:00
parent 7380cdfdc2
commit c0c7a6b49f
17 changed files with 77 additions and 34 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;
@ -171,9 +172,10 @@ namespace Realtime.Test {
string clientId = Guid.NewGuid().ToString();
LCIMClient client = new LCIMClient(clientId);
LCIMConversation conversation = await m1.CreateConversation(new string[] { clientId });
await client.Open();
LCIMTextMessage textMessage = new LCIMTextMessage("hello");
await conversation.Send(textMessage);
client.OnUnreadMessagesCountUpdated = (convs) => {
foreach (LCIMConversation conv in convs) {
WriteLine($"unread count: {conv.Unread}");
@ -181,11 +183,21 @@ namespace Realtime.Test {
Assert.True(conv.LastMessage is LCIMTextMessage);
LCIMTextMessage textMsg = conv.LastMessage as LCIMTextMessage;
Assert.AreEqual(textMsg.Text, "hello");
tcs.SetResult(true);
}
};
await client.Open();
client.OnMessage = (conv, msg) => {
WriteLine($"unread count: {conv.Unread}");
Assert.AreEqual(conv.Unread, 2);
Assert.True(conv.LastMessage is LCIMTextMessage);
LCIMTextMessage textMsg = conv.LastMessage as LCIMTextMessage;
Assert.AreEqual(textMsg.Text, "world");
tcs.SetResult(true);
};
textMessage = new LCIMTextMessage("world");
await conversation.Send(textMessage);
await tcs.Task;
}
@ -230,5 +242,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;
}
}
}

View File

@ -1,5 +1,5 @@
using NUnit.Framework;
using LeanCloud.Realtime.Protocol;
using LeanCloud.Realtime.Internal.Protocol;
using Google.Protobuf;
namespace Realtime.Test {

View File

@ -1,9 +1,9 @@
using NUnit.Framework;
using System.Threading.Tasks;
using LeanCloud;
using LeanCloud.Storage;
using LeanCloud.Common;
namespace LeanCloud.Test {
namespace Storage.Test {
public class ACLTest {
[SetUp]
public void SetUp() {

View File

@ -2,10 +2,10 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Linq;
using LeanCloud;
using LeanCloud.Storage;
using LeanCloud.Common;
namespace LeanCloud.Test {
namespace Storage.Test {
public class CloudTest {
[SetUp]
public void SetUp() {

View File

@ -1,8 +1,7 @@
using NUnit.Framework;
using LeanCloud.Storage;
using LeanCloud.Common;
namespace LeanCloud.Test {
namespace Storage.Test {
public class ExceptionTest {
[Test]
public void LeanCloudException() {

View File

@ -2,13 +2,13 @@
using System;
using System.Text;
using System.Threading.Tasks;
using LeanCloud;
using LeanCloud.Storage;
using LeanCloud.Common;
namespace LeanCloud.Test {
namespace Storage.Test {
public class FileTest {
static readonly string AvatarFilePath = "../../../assets/hello.png";
static readonly string APKFilePath = "../../../assets/test.apk";
static readonly string AvatarFilePath = "../../../../assets/hello.png";
static readonly string APKFilePath = "../../../../assets/test.apk";
[SetUp]
public void SetUp() {

View File

@ -1,7 +1,7 @@
using NUnit.Framework;
using LeanCloud.Storage;
namespace LeanCloud.Test {
namespace Storage.Test {
public class GeoTest {
[Test]
public void Calculate() {

View File

@ -2,10 +2,10 @@ using NUnit.Framework;
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using LeanCloud;
using LeanCloud.Storage;
using LeanCloud.Common;
namespace LeanCloud.Test {
namespace Storage.Test {
public class ObjectTest {
[SetUp]
public void SetUp() {

View File

@ -1,10 +1,10 @@
using NUnit.Framework;
using System.Collections.Generic;
using System.Threading.Tasks;
using LeanCloud;
using LeanCloud.Storage;
using LeanCloud.Common;
namespace LeanCloud.Test {
namespace Storage.Test {
public class OperationTest {
[SetUp]
public void SetUp() {

View File

@ -1,10 +1,10 @@
using NUnit.Framework;
using System.Collections.Generic;
using System.Threading.Tasks;
using LeanCloud;
using LeanCloud.Storage;
using LeanCloud.Common;
namespace LeanCloud.Test {
namespace Storage.Test {
public class QueryTest {
[SetUp]
public void SetUp() {

View File

@ -1,11 +1,10 @@
using NUnit.Framework;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
using LeanCloud;
using LeanCloud.Storage;
using LeanCloud.Common;
namespace LeanCloud.Test {
namespace Storage.Test {
public class RelationTest {
[SetUp]
public void SetUp() {

View File

@ -2,11 +2,10 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Linq;
using LeanCloud;
using LeanCloud.Storage;
using LeanCloud.Common;
namespace LeanCloud.Test {
namespace Storage.Test {
[TestFixture]
public class RoleTest {
[SetUp]

View File

@ -1,10 +1,10 @@
using NUnit.Framework;
using System.Threading.Tasks;
using System.Collections.Generic;
using LeanCloud;
using LeanCloud.Storage;
using LeanCloud.Common;
namespace LeanCloud.Test {
namespace Storage.Test {
internal class Hello : LCObject {
internal World World => this["objectValue"] as World;

View File

@ -2,10 +2,10 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using LeanCloud;
using LeanCloud.Storage;
using LeanCloud.Common;
namespace LeanCloud.Test {
namespace Storage.Test {
public class UserTest {
[SetUp]
public void SetUp() {

View File

@ -1,9 +1,7 @@
using System;
using NUnit.Framework;
using LeanCloud;
using LeanCloud.Common;
using NUnit.Framework;
namespace LeanCloud.Test {
namespace Storage.Test {
public static class Utils {
internal static void Print(LCLogLevel level, string info) {
switch (level) {

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB