chore: test

oneRain 2021-04-07 18:08:17 +08:00
parent de83d22534
commit 42c2e6c7e2
21 changed files with 65 additions and 75 deletions

View File

@ -14,6 +14,6 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LiveQuery\LiveQuery.csproj" />
<ProjectReference Include="..\LiveQuery.Standard\LiveQuery.Standard.csproj" />
</ItemGroup>
</Project>

View File

@ -43,19 +43,19 @@ namespace Realtime.Test {
}
}
[Test]
public async Task QueryCompact() {
string memberId = "m1";
LCIMConversationQuery query = new LCIMConversationQuery(client)
.WhereEqualTo("m", memberId);
query.Compact = true;
ReadOnlyCollection<LCIMConversation> conversations = await query.Find();
foreach (LCIMConversation conversation in conversations) {
Assert.True(conversation.MemberIds.Count == 0);
await conversation.Fetch();
Assert.True(conversation.MemberIds.Count > 0);
}
}
//[Test]
//public async Task QueryCompact() {
// string memberId = "m1";
// LCIMConversationQuery query = new LCIMConversationQuery(client)
// .WhereEqualTo("m", memberId);
// query.Compact = true;
// ReadOnlyCollection<LCIMConversation> conversations = await query.Find();
// foreach (LCIMConversation conversation in conversations) {
// Assert.True(conversation.MemberIds.Count == 0);
// await conversation.Fetch();
// Assert.True(conversation.MemberIds.Count > 0);
// }
//}
[Test]
public async Task QueryWithLastMessage() {

View File

@ -14,7 +14,7 @@ namespace Realtime.Test {
public Task<LCIMSignature> CreateConnectSignature(string clientId) {
long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
string nonce = NewNonce();
string signature = GenerateSignature(LCApplication.AppId, clientId, string.Empty, timestamp.ToString(), nonce);
string signature = GenerateSignature(LCInternalApplication.AppId, clientId, string.Empty, timestamp.ToString(), nonce);
return Task.FromResult(new LCIMSignature {
Signature = signature,
Timestamp = timestamp,
@ -31,7 +31,7 @@ namespace Realtime.Test {
}
long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
string nonce = NewNonce();
string signature = GenerateSignature(LCApplication.AppId, clientId, sortedMemberIds, timestamp.ToString(), nonce);
string signature = GenerateSignature(LCInternalApplication.AppId, clientId, sortedMemberIds, timestamp.ToString(), nonce);
return Task.FromResult(new LCIMSignature {
Signature = signature,
Timestamp = timestamp,
@ -48,7 +48,7 @@ namespace Realtime.Test {
}
long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
string nonce = NewNonce();
string signature = GenerateSignature(LCApplication.AppId, clientId, conversationId, sortedMemberIds, timestamp.ToString(), nonce, action);
string signature = GenerateSignature(LCInternalApplication.AppId, clientId, conversationId, sortedMemberIds, timestamp.ToString(), nonce, action);
return Task.FromResult(new LCIMSignature {
Signature = signature,
Timestamp = timestamp,
@ -65,7 +65,7 @@ namespace Realtime.Test {
}
long timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
string nonce = NewNonce();
string signature = GenerateSignature(LCApplication.AppId, clientId, conversationId, sortedMemberIds, timestamp.ToString(), nonce, action);
string signature = GenerateSignature(LCInternalApplication.AppId, clientId, conversationId, sortedMemberIds, timestamp.ToString(), nonce, action);
return Task.FromResult(new LCIMSignature {
Signature = signature,
Timestamp = timestamp,

View File

@ -14,6 +14,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Realtime\Realtime\Realtime.csproj" />
<ProjectReference Include="..\Realtime\Realtime.csproj" />
<ProjectReference Include="..\..\Storage\Storage.Standard\Storage.Standard.csproj" />
</ItemGroup>
</Project>

View File

@ -6,7 +6,9 @@ namespace Realtime.Test {
public static class Utils {
internal static void SetUp() {
LCLogger.LogDelegate += Print;
LCApplication.Initialize("3zWMOXuO9iSdnjXM942i6DdI-gzGzoHsz", "bkwiNq4Tj417eUaHlTWS5sPm", "https://3zwmoxuo.lc-cn-n1-shared.com");
LCApplication.Initialize("3zWMOXuO9iSdnjXM942i6DdI-gzGzoHsz",
"bkwiNq4Tj417eUaHlTWS5sPm",
"https://3zwmoxuo.lc-cn-n1-shared.com");
}
internal static void TearDown() {

View File

@ -8,13 +8,12 @@ namespace Storage.Test {
public class ACLTest {
[SetUp]
public void SetUp() {
LCLogger.LogDelegate += Utils.Print;
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
Utils.SetUp();
}
[TearDown]
public void TearDown() {
LCLogger.LogDelegate -= Utils.Print;
Utils.TearDown();
}
[Test]

View File

@ -9,13 +9,12 @@ namespace Storage.Test {
public class CaptchaTest {
[SetUp]
public void SetUp() {
LCLogger.LogDelegate += Utils.Print;
LCApplication.Initialize(Utils.AppId, Utils.AppKey, Utils.AppServer);
Utils.SetUp();
}
[TearDown]
public void TearDown() {
LCLogger.LogDelegate -= Utils.Print;
Utils.TearDown();
}
//[Test]

View File

@ -12,13 +12,12 @@ namespace Storage.Test {
[SetUp]
public void SetUp() {
LCLogger.LogDelegate += Utils.Print;
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
Utils.SetUp();
}
[TearDown]
public void TearDown() {
LCLogger.LogDelegate -= Utils.Print;
Utils.TearDown();
}
[Test]
@ -72,7 +71,7 @@ namespace Storage.Test {
[Test]
public async Task AWS() {
LCApplication.Initialize("UlCpyvLm8aMzQsW6KnP6W3Wt-MdYXbMMI", "PyCTYoNoxCVoKKg394PBeS4r");
LCInternalApplication.Initialize("UlCpyvLm8aMzQsW6KnP6W3Wt-MdYXbMMI", "PyCTYoNoxCVoKKg394PBeS4r");
LCFile file = new LCFile("avatar", AvatarFilePath);
await file.Save((count, total) => {
TestContext.WriteLine($"progress: {count}/{total}");

View File

@ -38,14 +38,12 @@ namespace Storage.Test {
[SetUp]
public void SetUp() {
LCLogger.LogDelegate += Utils.Print;
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo",
"https://ikggdre2.lc-cn-n1-shared.com");
Utils.SetUp();
}
[TearDown]
public void TearDown() {
LCLogger.LogDelegate -= Utils.Print;
Utils.TearDown();
}
[Test]

View File

@ -14,16 +14,15 @@ namespace Storage.Test {
[SetUp]
public void SetUp() {
LCLogger.LogDelegate += Utils.Print;
LCApplication.Initialize(Utils.AppId, Utils.AppKey, Utils.AppServer, Utils.MasterKey);
LCApplication.UseMasterKey = true;
LCInternalApplication.UseMasterKey = true;
leaderboardName = $"Leaderboard_{DateTimeOffset.Now.DayOfYear}";
}
[TearDown]
public void TearDown() {
LCApplication.UseMasterKey = false;
LCLogger.LogDelegate -= Utils.Print;
LCInternalApplication.UseMasterKey = false;
Utils.TearDown();
}
[Test]

View File

@ -11,13 +11,12 @@ namespace Storage.Test {
public class ObjectTest {
[SetUp]
public void SetUp() {
LCLogger.LogDelegate += Utils.Print;
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
Utils.SetUp();
}
[TearDown]
public void TearDown() {
LCLogger.LogDelegate -= Utils.Print;
Utils.TearDown();
}
[Test]

View File

@ -1,20 +1,18 @@
using NUnit.Framework;
using System.Collections.Generic;
using System.Threading.Tasks;
using LeanCloud;
using LeanCloud.Storage;
namespace Storage.Test {
public class OperationTest {
[SetUp]
public void SetUp() {
LCLogger.LogDelegate += Utils.Print;
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
Utils.SetUp();
}
[TearDown]
public void TearDown() {
LCLogger.LogDelegate -= Utils.Print;
Utils.TearDown();
}
[Test]

View File

@ -2,20 +2,18 @@
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Threading.Tasks;
using LeanCloud;
using LeanCloud.Storage;
namespace Storage.Test {
public class QueryTest {
[SetUp]
public void SetUp() {
LCLogger.LogDelegate += Utils.Print;
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
Utils.SetUp();
}
[TearDown]
public void TearDown() {
LCLogger.LogDelegate -= Utils.Print;
Utils.TearDown();
}
[Test]

View File

@ -1,20 +1,18 @@
using NUnit.Framework;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using LeanCloud;
using LeanCloud.Storage;
namespace Storage.Test {
public class RelationTest {
[SetUp]
public void SetUp() {
LCLogger.LogDelegate += Utils.Print;
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
Utils.SetUp();
}
[TearDown]
public void TearDown() {
LCLogger.LogDelegate -= Utils.Print;
Utils.TearDown();
}
[Test]

View File

@ -2,7 +2,6 @@
using System;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using LeanCloud;
using LeanCloud.Storage;
namespace Storage.Test {
@ -10,13 +9,12 @@ namespace Storage.Test {
public class RoleTest {
[SetUp]
public void SetUp() {
LCLogger.LogDelegate += Utils.Print;
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
Utils.SetUp();
}
[TearDown]
public void TearDown() {
LCLogger.LogDelegate -= Utils.Print;
Utils.TearDown();
}
[Test]

View File

@ -1,20 +1,18 @@
using NUnit.Framework;
using System.Collections.Generic;
using System.Threading.Tasks;
using LeanCloud;
using LeanCloud.Storage;
namespace Storage.Test {
public class SMSTest {
[SetUp]
public void SetUp() {
LCLogger.LogDelegate += Utils.Print;
LCApplication.Initialize(Utils.AppId, Utils.AppKey, Utils.AppServer);
Utils.SetUp();
}
[TearDown]
public void TearDown() {
LCLogger.LogDelegate -= Utils.Print;
Utils.TearDown();
}
//[Test]

View File

@ -3,7 +3,6 @@ using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using LeanCloud;
using LeanCloud.Storage;
namespace Storage.Test {
@ -14,14 +13,12 @@ namespace Storage.Test {
[SetUp]
public void SetUp() {
LCLogger.LogDelegate += Utils.Print;
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo",
"https://ikggdre2.lc-cn-n1-shared.com");
Utils.SetUp();
}
[TearDown]
public void TearDown() {
LCLogger.LogDelegate -= Utils.Print;
Utils.TearDown();
}
[Test]

View File

@ -17,6 +17,6 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Storage\Storage\Storage.csproj" />
<ProjectReference Include="..\Storage.Standard\Storage.Standard.csproj" />
</ItemGroup>
</Project>

View File

@ -39,13 +39,12 @@ namespace Storage.Test {
public class SubClassTest {
[SetUp]
public void SetUp() {
LCLogger.LogDelegate += Utils.Print;
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
Utils.SetUp();
}
[TearDown]
public void TearDown() {
LCLogger.LogDelegate -= Utils.Print;
Utils.TearDown();
}
[Test]

View File

@ -10,13 +10,12 @@ namespace Storage.Test {
public class UserTest {
[SetUp]
public void SetUp() {
LCLogger.LogDelegate += Utils.Print;
LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com");
Utils.SetUp();
}
[TearDown]
public void TearDown() {
LCLogger.LogDelegate -= Utils.Print;
Utils.TearDown();
}
[Test]
@ -31,7 +30,7 @@ namespace Storage.Test {
string mobile = $"151{random.Next(10000000, 99999999)}";
user.Mobile = mobile;
await user.SignUp();
TestContext.WriteLine(user.Username);
TestContext.WriteLine(user.Password);
@ -48,7 +47,7 @@ namespace Storage.Test {
LCUser current = await LCUser.GetCurrent();
Assert.NotNull(current.ObjectId);
Assert.IsFalse(current.EmailVerified);
Assert.IsFalse(current.MobileVerified);
Assert.IsFalse(!current.MobileVerified);
Assert.AreEqual(current.Mobile, "15101006007");
}

View File

@ -24,5 +24,14 @@ namespace Storage.Test {
break;
}
}
internal static void SetUp() {
LCLogger.LogDelegate += Print;
LCApplication.Initialize(AppId, AppKey, AppServer);
}
internal static void TearDown() {
LCLogger.LogDelegate -= Print;
}
}
}