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

70 lines
3.1 KiB
C#

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");
}
}
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;
}
}
}
}