2019-07-30 16:47:10 +08:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using LeanCloud;
|
|
|
|
|
|
|
|
|
|
namespace LeanCloudTests {
|
|
|
|
|
public class ObjectControllerTests {
|
|
|
|
|
[SetUp]
|
|
|
|
|
public void SetUp() {
|
2019-08-27 17:27:46 +08:00
|
|
|
|
Utils.InitNorthChina();
|
2019-07-30 16:47:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public async Task TestSave() {
|
|
|
|
|
TestContext.Out.WriteLine($"before at {Thread.CurrentThread.ManagedThreadId}");
|
|
|
|
|
var obj = AVObject.Create("Foo");
|
|
|
|
|
obj["content"] = "hello, world";
|
|
|
|
|
await obj.SaveAsync();
|
2019-08-06 12:16:17 +08:00
|
|
|
|
TestContext.Out.WriteLine($"{obj.ObjectId} saved at {Thread.CurrentThread.ManagedThreadId}");
|
2019-07-30 16:47:10 +08:00
|
|
|
|
Assert.NotNull(obj.ObjectId);
|
|
|
|
|
Assert.NotNull(obj.CreatedAt);
|
|
|
|
|
Assert.NotNull(obj.UpdatedAt);
|
2019-08-27 17:27:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public async Task ObjectFetch() {
|
|
|
|
|
AVObject obj = AVObject.CreateWithoutData("Todo", "5d5f6039d5de2b006cf29c8f");
|
|
|
|
|
await obj.FetchAsync();
|
|
|
|
|
Assert.NotNull(obj["title"]);
|
|
|
|
|
Assert.NotNull(obj["content"]);
|
|
|
|
|
TestContext.Out.WriteLine($"{obj["title"]}, {obj["content"]}");
|
|
|
|
|
}
|
2019-07-30 16:47:10 +08:00
|
|
|
|
}
|
|
|
|
|
}
|