public void TestDeleteSingleObject_OpResult()
        {
            List <Person> personList   = new List <Person>();
            Person        personObject = new Person();

            personObject.name = "Bob";
            personObject.age  = 23;
            personList.Add(personObject);
            String objectId = Backendless.Data.Of <Person>().Create(personList)[0];

            UnitOfWork uow = new UnitOfWork();

            DataQueryBuilder queryBuilder = DataQueryBuilder.Create();

            queryBuilder.SetWhereClause("age = '23'");

            OpResult opResult = uow.Find("Person", queryBuilder);
            OpResultValueReference firstInvalid = opResult.ResolveTo(0);

            uow.Delete(firstInvalid);

            UnitOfWorkResult uowResult = uow.Execute();

            Assert.IsTrue(uowResult.Success);
            Assert.IsNotNull(uowResult.Results);

            IList <Person> listCheckPerson = Backendless.Data.Of <Person>().Find();

            Assert.IsTrue(listCheckPerson.Count == 0);
        }
        public void TestUpdateSingleObject_OpResult()
        {
            List <Dictionary <String, Object> > objectsForCreate = new List <Dictionary <String, Object> >();
            Dictionary <String, Object>         objectData       = new Dictionary <String, Object>();
            Dictionary <String, Object>         wrongObject      = new Dictionary <String, Object>();

            wrongObject["age"] = 1212;
            objectData["age"]  = 12;
            objectsForCreate.Add(objectData);
            objectsForCreate.Add(wrongObject);
            IList <String> createResult = Backendless.Data.Of("Person").Create(objectsForCreate);

            UnitOfWork uow = new UnitOfWork();

            DataQueryBuilder dQB = DataQueryBuilder.Create();

            dQB.SetWhereClause("age = 12");
            dQB.SetPageSize(1);

            OpResult findResult = uow.Find("Person", dQB);

            OpResultValueReference objectRef = findResult.ResolveTo(0);

            Dictionary <String, Object> changes = new Dictionary <String, Object>();

            changes["age"] = 100500;

            OpResult updatePerson = uow.Update(objectRef, changes);

            UnitOfWorkResult uowResult = uow.Execute();

            Assert.IsTrue(uowResult.Success);
            Assert.IsNotNull(uowResult.Results);

            Dictionary <String, OperationResult> result   = uowResult.Results;
            OperationResult             operationResult   = result[updatePerson.OpResultId];
            Dictionary <Object, Object> transactionResult = (Dictionary <Object, Object>)operationResult.Result;

            Assert.IsTrue((Int32)transactionResult["age"] == 100500);
            Assert.IsTrue((String)transactionResult["objectId"] == createResult[0]);
            Backendless.Data.Of("Person").Remove("age = '100500'");
            Backendless.Data.Of("Person").Remove("age = '1212'");
        }