2019-09-02 14:23:23 +08:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using System.Threading.Tasks;
|
2020-05-06 16:02:26 +08:00
|
|
|
|
using System.Collections.ObjectModel;
|
2020-02-26 11:16:21 +08:00
|
|
|
|
using LeanCloud.Storage;
|
2019-09-02 14:23:23 +08:00
|
|
|
|
|
2020-04-28 17:04:46 +08:00
|
|
|
|
namespace Storage.Test {
|
2021-04-29 15:58:22 +08:00
|
|
|
|
public class SubClassTest : BaseTest {
|
2019-09-02 14:23:23 +08:00
|
|
|
|
[Test]
|
2020-02-26 11:16:21 +08:00
|
|
|
|
public async Task Create() {
|
|
|
|
|
Account account = new Account();
|
|
|
|
|
account.Balance = 1000;
|
|
|
|
|
await account.Save();
|
|
|
|
|
TestContext.WriteLine(account.ObjectId);
|
|
|
|
|
Assert.NotNull(account.ObjectId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public async Task Query() {
|
|
|
|
|
LCQuery<Account> query = new LCQuery<Account>("Account");
|
|
|
|
|
query.WhereGreaterThan("balance", 500);
|
2020-05-06 16:02:26 +08:00
|
|
|
|
ReadOnlyCollection<Account> list = await query.Find();
|
2020-02-26 11:16:21 +08:00
|
|
|
|
TestContext.WriteLine(list.Count);
|
|
|
|
|
Assert.Greater(list.Count, 0);
|
|
|
|
|
foreach (Account account in list) {
|
|
|
|
|
Assert.NotNull(account.ObjectId);
|
2019-09-02 14:23:23 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-02-26 11:16:21 +08:00
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public async Task Delete() {
|
|
|
|
|
Account account = new Account() {
|
|
|
|
|
Balance = 1024
|
|
|
|
|
};
|
|
|
|
|
await account.Save();
|
|
|
|
|
await account.Delete();
|
|
|
|
|
}
|
2019-09-02 14:23:23 +08:00
|
|
|
|
}
|
|
|
|
|
}
|