2019-08-01 17:36:34 +08:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using LeanCloud;
|
|
|
|
|
|
|
|
|
|
namespace LeanCloudTests {
|
|
|
|
|
public class QueryTest {
|
|
|
|
|
[SetUp]
|
|
|
|
|
public void SetUp() {
|
|
|
|
|
AVClient.Initialize(new AVClient.Configuration {
|
|
|
|
|
ApplicationId = "BMYV4RKSTwo8WSqt8q9ezcWF-gzGzoHsz",
|
|
|
|
|
ApplicationKey = "pbf6Nk5seyjilexdpyrPwjSp",
|
2019-08-06 15:21:39 +08:00
|
|
|
|
ApiServer = "https://avoscloud.com"
|
2019-08-01 17:36:34 +08:00
|
|
|
|
});
|
|
|
|
|
AVClient.HttpLog(TestContext.Out.WriteLine);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public async Task TestQuery() {
|
2019-08-06 18:26:56 +08:00
|
|
|
|
var query = new AVQuery<AVObject>("Foo");
|
|
|
|
|
query.WhereEqualTo("content", "hello");
|
2019-08-06 15:21:39 +08:00
|
|
|
|
var results = await query.FindAsync();
|
|
|
|
|
foreach (var result in results) {
|
|
|
|
|
TestContext.Out.WriteLine(result.ObjectId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public async Task TestQueryCount() {
|
2019-08-06 18:26:56 +08:00
|
|
|
|
var query = new AVQuery<AVObject>("Foo");
|
|
|
|
|
query.WhereEqualTo("content", "hello, world");
|
2019-08-01 17:36:34 +08:00
|
|
|
|
var count = await query.CountAsync();
|
|
|
|
|
Assert.Greater(count, 8);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|