public void TestSaveGetBoolean() { Task.Run(async() => { var message = "Hello, world"; var item = new NCMBObject("DataStoreTest"); item.Set("message", message); item.Set("bol1", true); item.Set("bol2", false); await item.Save(); Assert.NotNull(item.Get("objectId")); await item.Fetch(); Assert.IsTrue(item.GetBoolean("bol1")); Assert.IsTrue(!item.GetBoolean("bol2")); await item.Delete(); }).GetAwaiter().GetResult(); }
public void TestSaveAndGetGeoPoint() { Task.Run(async() => { var latitude = 35.6585805; var longitude = 139.7454329; var geo = new NCMBGeoPoint(latitude, longitude); var item = new NCMBObject("Item"); item.Set("geo", geo); await item.Save(); await item.Fetch(); var geo1 = (NCMBGeoPoint)item.Get("geo"); Assert.NotNull(item.Get("objectId")); Assert.AreEqual(geo1.Latitude, geo.Latitude); await item.Delete(); }).GetAwaiter().GetResult(); }
public void TestSaveAndFetchSync() { Task.Run(async() => { var message = "Hello, world"; var item = new NCMBObject("DataStoreTest"); item.Set("message", message); await item.Save(); Assert.NotNull(item.ObjectId()); var objectId = item.ObjectId(); var newItem = new NCMBObject("DataStoreTest"); newItem.Set("objectId", objectId); await newItem.Fetch(); Assert.AreEqual(item.ObjectId(), newItem.ObjectId()); Assert.AreEqual(newItem.Get("message").ToString(), message); await item.Delete(); }).GetAwaiter().GetResult(); }