public void TestFindWithNullPropertiesQuery() { RunAndAwait( () => { var findWithPropertiesEntity = new FindWithPropertiesEntityAsync {Name = "bot_#foobar", Age = 20}; Backendless.Persistence.Save( findWithPropertiesEntity, new ResponseCallback<FindWithPropertiesEntityAsync>( this ) { ResponseHandler = response => { List<String> properties = null; var dataQuery = new BackendlessDataQuery( properties ); Backendless.Persistence.Of<FindWithPropertiesEntityAsync>() .Find( dataQuery, new ResponseCallback <BackendlessCollection<FindWithPropertiesEntityAsync>> ( this ) { ResponseHandler = backendlessCollection => { Assert.IsTrue( backendlessCollection.TotalObjects > 0, "Server found wrong number of objects" ); Assert.IsTrue( backendlessCollection.GetCurrentPage().Count > 0, "Server returned wrong number of objects" ); foreach( FindWithPropertiesEntityAsync 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" ); } CountDown(); } } ); } } ); } ); }
public void TestFindWithMissingProperties() { RunAndAwait( () => { var findWithPropertiesEntity = new FindWithPropertiesEntityAsync {Name = "bot_#foobar", Age = 20}; Backendless.Persistence.Save( findWithPropertiesEntity, new ResponseCallback<FindWithPropertiesEntityAsync>( this ) { ResponseHandler = response => { var properties = new List<string> {"foobar"}; var dataQuery = new BackendlessDataQuery( properties ); Backendless.Persistence.Of<FindWithPropertiesEntityAsync>() .Find( dataQuery, new AsyncCallback <BackendlessCollection<FindWithPropertiesEntityAsync>> ( collection => Assert.Fail( "Server didn't throw an exception" ), fault => CheckErrorCode( 1006, fault ) ) ); } } ); } ); }