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

39 lines
1.1 KiB
C#
Raw Normal View History

using NUnit.Framework;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using LeanCloud.Storage;
2020-04-28 17:04:46 +08:00
namespace Storage.Test {
2021-04-29 15:58:22 +08:00
public class SubClassTest : BaseTest {
[Test]
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);
ReadOnlyCollection<Account> list = await query.Find();
TestContext.WriteLine(list.Count);
Assert.Greater(list.Count, 0);
foreach (Account account in list) {
Assert.NotNull(account.ObjectId);
}
}
[Test]
public async Task Delete() {
Account account = new Account() {
Balance = 1024
};
await account.Save();
await account.Delete();
}
}
}