using NUnit.Framework; using System.Collections.Generic; using System.Threading.Tasks; using LeanCloud.Storage; namespace LeanCloud.Test { public class HelloTest { [SetUp] public void SetUp() { LeanCloud.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com"); Logger.LogDelegate += Utils.Print; } [Test] public async Task Run() { Dictionary parameters = new Dictionary { { "name", "world" } }; Dictionary response = await LCCloud.Run("hello", parameters); string ret = response["result"] as string; TestContext.WriteLine($"ret: {ret}"); Assert.AreEqual(ret, "hello, world"); } [Test] public async Task Query() { LCQuery query = new LCQuery("Hello"); query.Limit(30); List results = await query.Find(); TestContext.WriteLine(results.Count); foreach (LCObject obj in results) { TestContext.WriteLine(obj.ObjectId); Assert.NotNull(obj.ObjectId); } } [Test] public void InitByNull() { List sl = new List { "a", "a", "b" }; HashSet ss = new HashSet(sl); TestContext.WriteLine(ss.Count); } [Test] public async Task Save() { LCObject hello = new LCObject("Hello"); await hello.Save(); TestContext.WriteLine($"object id: {hello.ObjectId}"); Assert.NotNull(hello.ObjectId); } } }