public void DisassembleAndAssemble() { using (ISession s = OpenSession()) { ISessionImplementor si = (ISessionImplementor)s; var set = new PersistentGenericSet <int>(si, new HashSet <int>()); set.Add(10); set.Add(20); CollectionPersisterStub collectionPersister = new CollectionPersisterStub(); collectionPersister.ElementType = NHibernateUtil.Int32; object disassembled = set.Disassemble(collectionPersister); var assembledSet = new PersistentGenericSet <int>(si); assembledSet.InitializeFromCache(collectionPersister, disassembled, null); Assert.AreEqual(2, assembledSet.Count); Assert.IsTrue(assembledSet.Contains(10)); Assert.IsTrue(assembledSet.Contains(20)); } }
public void DisassembleAndAssemble() { Set set = new Set( null, new Iesi.Collections.ListSet() ); set.CollectionSnapshot = new CollectionSnapshotStub(); set.Add(10); set.Add(20); CollectionPersisterStub collectionPersister = new CollectionPersisterStub(); collectionPersister.ElementType = NHibernateUtil.Int32; object disassembled = set.Disassemble(collectionPersister); Set assembledSet = new Set( null ); assembledSet.InitializeFromCache( collectionPersister, disassembled, null ); Assert.AreEqual( 2, assembledSet.Count ); Assert.IsTrue( assembledSet.Contains( 10 ) ); Assert.IsTrue( assembledSet.Contains( 20 ) ); }
public void DisassembleAndAssemble() { using (ISession s = OpenSession()) { ISessionImplementor si = (ISessionImplementor) s; PersistentSet set = new PersistentSet(si, new ListSet()); set.Add(10); set.Add(20); CollectionPersisterStub collectionPersister = new CollectionPersisterStub(); collectionPersister.ElementType = NHibernateUtil.Int32; object disassembled = set.Disassemble(collectionPersister); PersistentSet assembledSet = new PersistentSet(si); assembledSet.InitializeFromCache(collectionPersister, disassembled, null); Assert.AreEqual(2, assembledSet.Count); Assert.IsTrue(assembledSet.Contains(10)); Assert.IsTrue(assembledSet.Contains(20)); } }