* Utils.cs:
* AVObject.cs: * CloudFunctionTest.cs: * ObjectSubclassingController.cs: chore: 测试云函数
parent
7a5aef733d
commit
9d932f0f0b
|
@ -0,0 +1,22 @@
|
|||
using NUnit.Framework;
|
||||
using LeanCloud;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LeanCloudTests {
|
||||
public class CloudFunctionTest {
|
||||
[SetUp]
|
||||
public void SetUp() {
|
||||
Utils.InitNorthChina();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Hello() {
|
||||
AVClient.UseProduction = true;
|
||||
string result = await AVCloud.CallFunctionAsync<string>("hello", new Dictionary<string, object> {
|
||||
{ "word", "world" }
|
||||
});
|
||||
TestContext.Out.WriteLine($"resutlt: {result}");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,34 +6,35 @@ namespace LeanCloudTests {
|
|||
public static class Utils {
|
||||
public static void InitNorthChina(bool master = false) {
|
||||
if (master) {
|
||||
Init("BMYV4RKSTwo8WSqt8q9ezcWF-gzGzoHsz", "pbf6Nk5seyjilexdpyrPwjSp", "https://avoscloud.com", "qKH9ryRagHKvXeRRVkiUiHeb");
|
||||
Init("BMYV4RKSTwo8WSqt8q9ezcWF-gzGzoHsz", "pbf6Nk5seyjilexdpyrPwjSp", "https://avoscloud.com", "https://avoscloud.com", "qKH9ryRagHKvXeRRVkiUiHeb");
|
||||
} else {
|
||||
Init("BMYV4RKSTwo8WSqt8q9ezcWF-gzGzoHsz", "pbf6Nk5seyjilexdpyrPwjSp", "https://avoscloud.com");
|
||||
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", "eqEp4n89h4zanWFskDDpIwL4");
|
||||
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");
|
||||
Init("4eTwHdYhMaNBUpl1SrTr7GLC-9Nh9j0Va", "GSD6DtdgGWlWolivN4qhWtlE", "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", "Ahb1wdFLwMgKwEaEicHRXbCY");
|
||||
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");
|
||||
Init("MFAS1GnOyomRLSQYRaxdgdPz-MdYXbMMI", "p42JUxdxb95K5G8187t5ba3l", "https://MFAS1GnO.api.lncldglobal.com", "https://MFAS1GnO.engine.lncldglobal.com");
|
||||
}
|
||||
}
|
||||
|
||||
static void Init(string appId, string appKey, string apiServer, string masterKey = null) {
|
||||
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
|
||||
ApiServer = apiServer,
|
||||
EngineServer = engineServer,
|
||||
});
|
||||
AVClient.UseMasterKey = !string.IsNullOrEmpty(masterKey);
|
||||
AVClient.HttpLog(TestContext.Out.WriteLine);
|
||||
|
|
|
@ -126,9 +126,8 @@ namespace LeanCloud.Storage.Internal {
|
|||
|
||||
public IDictionary<string, string> GetPropertyMappings(string className) {
|
||||
mutex.EnterReadLock();
|
||||
registeredSubclasses.TryGetValue(className, out info);
|
||||
if (info == null) {
|
||||
registeredSubclasses.TryGetValue(avObjectClassName, out info);
|
||||
if (!registeredSubclasses.TryGetValue(className, out ObjectSubclassInfo info)) {
|
||||
_ = registeredSubclasses.TryGetValue(avObjectClassName, out info);
|
||||
}
|
||||
mutex.ExitReadLock();
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ namespace LeanCloud {
|
|||
}
|
||||
|
||||
private static string GetFieldForPropertyName(string className, string propertyName) {
|
||||
SubclassingController.GetPropertyMappings(className).TryGetValue(propertyName, out fieldName);
|
||||
SubclassingController.GetPropertyMappings(className).TryGetValue(propertyName, out string fieldName);
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue