public virtual void Write(IWriteContext context, object obj)
 {
     _writeCalls++;
     TranslatorToTypehandlerMigrationTestCase.Item item = (TranslatorToTypehandlerMigrationTestCase.Item
                                                           )obj;
     context.WriteInt(item._id + 42);
 }
 public virtual object OnStore(IObjectContainer container, object applicationObject
                               )
 {
     _storeCalls++;
     TranslatorToTypehandlerMigrationTestCase.Item item = (TranslatorToTypehandlerMigrationTestCase.Item
                                                           )applicationObject;
     return(item._id.ToString());
 }
            public virtual void OnActivate(IObjectContainer container, object applicationObject
                                           , object storedObject)
            {
                _activateCalls++;
                string str = (string)storedObject;

                TranslatorToTypehandlerMigrationTestCase.Item item = (TranslatorToTypehandlerMigrationTestCase.Item
                                                                      )applicationObject;
                item._id = int.Parse(str);
            }
 public virtual void TestTypeHandler()
 {
     _translator  = null;
     _typeHandler = new TranslatorToTypehandlerMigrationTestCase.ItemTypeHandler();
     Store(new TranslatorToTypehandlerMigrationTestCase.Item(42));
     AssertTypeHandlerCalls(1, 0);
     TranslatorToTypehandlerMigrationTestCase.Item item = RetrieveOnlyItemInstance();
     Assert.AreEqual(42, item._id);
     AssertTypeHandlerCalls(0, 1);
     UpdateItem();
     AssertTypeHandlerCalls(1, 1);
 }
        private void Store(TranslatorToTypehandlerMigrationTestCase.Item item)
        {
            IObjectContainer db = OpenContainer();

            try
            {
                db.Store(item);
            }
            finally
            {
                db.Close();
            }
        }
        private TranslatorToTypehandlerMigrationTestCase.Item RetrieveOnlyItemInstance()
        {
            IObjectContainer db = OpenContainer();

            try
            {
                IObjectSet objectSet = db.Query(typeof(TranslatorToTypehandlerMigrationTestCase.Item
                                                       ));
                Assert.AreEqual(1, objectSet.Count);
                TranslatorToTypehandlerMigrationTestCase.Item item = (TranslatorToTypehandlerMigrationTestCase.Item
                                                                      )objectSet.Next();
                return(item);
            }
            finally
            {
                db.Close();
            }
        }