Exemplo n.º 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" );
              }
        }
Exemplo n.º 2
0
        public void TestFindWithMissingProperties()
        {
            var findWithPropertiesEntity = new FindWithPropertiesEntity {Name = "bot_#foobar", Age = 20};
              Backendless.Persistence.Save( findWithPropertiesEntity );

              var properties = new List<string> {"foobar"};
              var dataQuery = new BackendlessDataQuery( properties );

              try
              {
            Backendless.Persistence.Of<FindWithPropertiesEntity>().Find( dataQuery );
            Assert.Fail( "Server didn't throw an exception" );
              }
              catch( System.Exception e )
              {
            CheckErrorCode( 1006, e );
              }
        }