コード例 #1
0
        public void TestFindWithNullPropertiesQuery()
        {
            var findWithPropertiesEntity = new FindWithPropertiesEntity {
                Name = "bot_#foobar", Age = 20
            };

            Backendless.Persistence.Save(findWithPropertiesEntity);

            List <String> properties = null;
            var           dataQuery  = new BackendlessDataQuery(properties);

            BackendlessCollection <FindWithPropertiesEntity> backendlessCollection =
                Backendless.Persistence.Of <FindWithPropertiesEntity>().Find(dataQuery);

            Assert.IsTrue(backendlessCollection.TotalObjects > 0, "Server found wrong number of objects");
            Assert.IsTrue(backendlessCollection.GetCurrentPage().Count > 0, "Server returned wrong number of objects");

            foreach (FindWithPropertiesEntity entity in backendlessCollection.GetCurrentPage())
            {
                Assert.IsTrue(entity.Age > 0, "Server result contained wrong age field value");
                Assert.IsNotNull(entity.Name, "Server result contained non null field");
                Assert.IsNotNull(entity.ObjectId, "Server result contained non null field");
                Assert.IsNotNull(entity.Created, "Server result contained non null field");
            }
        }
コード例 #2
0
ファイル: TestsFrame.cs プロジェクト: fturner19/Unity-SDK
        public void AssertArgumentAndResultCollections <T>(List <T> entities, BackendlessCollection <T> backendlessCollection)
        {
            Assert.AreEqual(entities.Count, backendlessCollection.TotalObjects, "Server found wrong number of objects");
            Assert.AreEqual(entities.Count, backendlessCollection.GetCurrentPage().Count,
                            "Server returned wrong number of objects");

            foreach (T entity in entities)
            {
                Assert.IsTrue(backendlessCollection.GetCurrentPage().Contains(entity),
                              "Server result didn't contain expected entity");
            }
        }
コード例 #3
0
ファイル: TestsFrame.cs プロジェクト: fturner19/Unity-SDK
        public void GetCollectionAndCheck(double startingLat, double startingLong, int maxPoints, double offset,
                                          Dictionary <string, string> meta, BackendlessGeoQuery geoQuery)
        {
            int counter = maxPoints;

            if (geoQuery.Categories.Count == 0 && GetDefinedCategories() != null)
            {
                geoQuery.Categories = GetDefinedCategories();
            }

            BackendlessCollection <GeoPoint> geoPointBackendlessCollection = Backendless.Geo.GetPoints(geoQuery);

            Assert.IsNotNull(geoPointBackendlessCollection, "Server returned a null collection");

            foreach (GeoPoint geoPoint in geoPointBackendlessCollection.GetCurrentPage())
            {
                if (meta == null || meta.Count == 0)
                {
                    Assert.IsTrue(geoPoint.Metadata.Count == 0, "Server returned points with unexpected metadata");
                }
                else
                {
                    foreach (KeyValuePair <string, string> keyValuePair in meta)
                    {
                        Assert.IsTrue(geoPoint.Metadata.ContainsKey(keyValuePair.Key), "Server returned points with unexpected metadata");
                        Assert.IsTrue(geoPoint.Metadata[keyValuePair.Key].Equals(keyValuePair.Value), "Server returned points with unexpected metadata");
                    }
                }

                Assert.AreEqual(startingLat, geoPoint.Latitude, 0.0000000001d,
                                "Server returned points from unexpected latitude range");
                Assert.IsTrue(geoPoint.Longitude >= startingLong && geoPoint.Longitude <= (startingLong + offset),
                              "Server returned points from unexpected longtitude range");

                counter--;
            }

            Assert.AreEqual(counter, 0, "Server found wrong total points count");
        }