csharp-sdk-upm/Storage/Storage.Test/Utils.cs

70 lines
3.1 KiB
C#
Raw Normal View History

using System;
using LeanCloud;
using LeanCloud.Common;
using NUnit.Framework;
namespace LeanCloud.Test {
public static class Utils {
public static void InitNorthChina(bool master = false) {
if (master) {
Init("BMYV4RKSTwo8WSqt8q9ezcWF-gzGzoHsz", "pbf6Nk5seyjilexdpyrPwjSp", "https://avoscloud.com", "https://avoscloud.com", "qKH9ryRagHKvXeRRVkiUiHeb");
} else {
Init("BMYV4RKSTwo8WSqt8q9ezcWF-gzGzoHsz", "pbf6Nk5seyjilexdpyrPwjSp", "https://avoscloud.com", "https://avoscloud.com");
}
}
public static void InitEastChina(bool master = false) {
if (master) {
Init("4eTwHdYhMaNBUpl1SrTr7GLC-9Nh9j0Va", "GSD6DtdgGWlWolivN4qhWtlE", "https://4eTwHdYh.api.lncldapi.com", "https://4eTwHdYh.engine.lncldapi.com", "eqEp4n89h4zanWFskDDpIwL4");
} else {
Init("4eTwHdYhMaNBUpl1SrTr7GLC-9Nh9j0Va", "GSD6DtdgGWlWolivN4qhWtlE", "https://4eTwHdYh.api.lncldapi.com", "https://4eTwHdYh.engine.lncldapi.com");
}
}
* csharp-sdk.sln: chore: 重构 AVFile 为 AVObject 的子类 * RTM.csproj: * AVQuery2.cs: * AVRealtime.cs: * AVIMNotice.cs: * AVIMClient.cs: * AVIMMessage.cs: * Utils.cs: * ICacheEngine.cs: * IAVIMMessage.cs: * AVIMSignature.cs: * AVIMEventArgs.cs: * IAVIMListener.cs: * AVIMException.cs: * JustTest.cs: * FileTest.cs: * AVIMEnumerator.cs: * AVFile.cs: * QueryTest.cs: * AVIMTextMessage.cs: * AVQuery.cs: * AVObject.cs: * AVIMTypedMessage.cs: * AVIMImageMessage.cs: * IAVTimer.cs: * AVIMConversation.cs: * AVClient.cs: * AVIMAudioMessage.cs: * ISignatureFactory.cs: * AVIMCorePlugins.cs: * AVIMBinaryMessage.cs: * AVIMRecalledMessage.cs: * AVIMMessageListener.cs: * AckCommand.cs: * IAVIMPlatformHooks.cs: * AVIMConversationQuery.cs: * AVIMCommand.cs: * ReadCommand.cs: * PatchCommand.cs: * GoAwayListener.cs: * AVIMProtocol.cs: * MessageCommand.cs: * SessionListener.cs: * SessionCommand.cs: * AVIMTemporaryConversation.cs: * RouterState.cs: * AVRouterController.cs: * AVIMCommandRunner.cs: * IAVIMCommandRunner.cs: * AVDecoder.cs: * IAVRouterController.cs: * IWebSocketClient.cs: * MessagePatchListener.cs: * ConversationCommand.cs: * AVIMMessageFieldNameAttribute.cs: * AVIMMessageClassNameAttribute.cs: * QueryOperation.cs: * QueryCondition.cs: * OfflineMessageListener.cs: * AVIMTypedMessageTypeIntAttribute.cs: * AVTimer.Portable.cs: * AVIMConversationListener.cs: * ConversationUnreadListener.cs: * StringEngine.cs: * AWSUploader.cs: * DateTimeEngine.cs: * QiniuUploader.cs: * QCloudUploader.cs: * DictionaryEngine.cs: * AVFileController.cs: * FreeStyleMessageClassInfo.cs: * DefaultWebSocketClient.Portable.cs: * FreeStyleMessageClassingController.cs: * IFreeStyleMessageClassingController.cs:
2019-09-12 15:07:19 +08:00
public static void InitOldEastChina(bool master = false) {
if (master) {
Init("SpT4SjWdvM9TSvCTKk6rqYQ9-9Nh9j0Va", "4NvN2OfdsWFC7qzzNcNS6paS", "https://4eTwHdYh.api.lncldapi.com", "https://4eTwHdYh.engine.lncldapi.com", "eqEp4n89h4zanWFskDDpIwL4");
} else {
Init("SpT4SjWdvM9TSvCTKk6rqYQ9-9Nh9j0Va", "4NvN2OfdsWFC7qzzNcNS6paS", "https://4eTwHdYh.api.lncldapi.com", "https://4eTwHdYh.engine.lncldapi.com");
}
}
public static void InitUS(bool master = false) {
if (master) {
Init("MFAS1GnOyomRLSQYRaxdgdPz-MdYXbMMI", "p42JUxdxb95K5G8187t5ba3l", "https://MFAS1GnO.api.lncldglobal.com", "https://MFAS1GnO.engine.lncldglobal.com", "Ahb1wdFLwMgKwEaEicHRXbCY");
} else {
Init("MFAS1GnOyomRLSQYRaxdgdPz-MdYXbMMI", "p42JUxdxb95K5G8187t5ba3l", "https://MFAS1GnO.api.lncldglobal.com", "https://MFAS1GnO.engine.lncldglobal.com");
}
}
static void Init(string appId, string appKey, string apiServer, string engineServer, string masterKey = null) {
AVClient.Initialize(new AVClient.Configuration {
ApplicationId = appId,
ApplicationKey = appKey,
MasterKey = masterKey,
ApiServer = apiServer,
EngineServer = engineServer
});
AVClient.UseMasterKey = !string.IsNullOrEmpty(masterKey);
AVClient.HttpLog(TestContext.Out.WriteLine);
}
internal static void Print(LogLevel level, string info) {
switch (level) {
case LogLevel.Debug:
TestContext.Out.WriteLine($"[DEBUG] {info}");
break;
case LogLevel.Warn:
TestContext.Out.WriteLine($"[WARNING] {info}");
break;
case LogLevel.Error:
TestContext.Out.WriteLine($"[ERROR] {info}");
break;
default:
TestContext.Out.WriteLine(info);
break;
}
}
}
}