Example #1
0
    public void TestFindRecordById()
    {
      RunAndAwait( () =>
        {
          var entity = new StringEntityAsync {StringField = "foobar"};
          Backendless.Persistence.Save( entity,
                                        new ResponseCallback<StringEntityAsync>( this )
                                          {
                                            ResponseHandler = savedEntity =>
                                              {
                                                Assert.IsNotNull( savedEntity, "Server returned a null result" );
                                                Assert.IsNotNull( savedEntity.StringField,
                                                                  "Returned object doesn't have expected field" );
                                                Assert.IsNotNull( savedEntity.ObjectId,
                                                                  "Returned object doesn't have expected field id" );
                                                Assert.IsNotNull( savedEntity.Created,
                                                                  "Returned object doesn't have expected field created" );
                                                Assert.AreEqual( entity.StringField, savedEntity.StringField,
                                                                 "Returned object has wrong field value" );

                                                var foundEntity =
                                                  Backendless.Persistence.Of<StringEntityAsync>()
                                                             .FindById( savedEntity.ObjectId );
                                                Assert.AreEqual( savedEntity.Created, foundEntity.Created,
                                                                 "Found object contain wrong created date" );
                                                Assert.AreEqual( savedEntity.ObjectId, foundEntity.ObjectId,
                                                                 "Found object contain wrong objectId" );
                                                Assert.AreEqual( savedEntity.StringField, foundEntity.StringField,
                                                                 "Found object contain wrong field value" );

                                                CountDown();
                                              }
                                          } );
        } );
    }
 public void TestSaveStringEntityAsync()
 {
   RunAndAwait( () =>
     {
       StringEntityAsync EntityAsync = new StringEntityAsync {StringField = "foobar"};
       Backendless.Persistence.Save( EntityAsync,
                                     new ResponseCallback<StringEntityAsync>( this )
                                       {
                                         ResponseHandler = savedEntityAsync =>
                                           {
                                             Assert.IsNotNull( savedEntityAsync, "Server returned a null result" );
                                             Assert.IsNotNull( savedEntityAsync.StringField,
                                                               "Returned object doesn't have expected field" );
                                             Assert.IsNotNull( savedEntityAsync.ObjectId,
                                                               "Returned object doesn't have expected field id" );
                                             Assert.IsNotNull( savedEntityAsync.Created,
                                                               "Returned object doesn't have expected field created" );
                                             Assert.AreEqual( EntityAsync.StringField, savedEntityAsync.StringField,
                                                              "Returned object has wrong field value" );
                                             CountDown();
                                           }
                                       } );
     } );
 }
Example #3
0
 protected bool Equals(StringEntityAsync other)
 {
     return(base.Equals(other) && string.Equals(StringField, other.StringField));
 }
Example #4
0
 protected bool Equals( StringEntityAsync other )
 {
     return base.Equals( other ) && string.Equals( StringField, other.StringField );
 }