From: Michael D. <mik...@us...> - 2004-10-04 01:43:56
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30348/NHibernate.Test/NHSpecificTest Modified Files: Tag: alpha_avalon-proxy AvalonProxyFixture.cs Log Message: implemented some of the test that were being ignored because proxy of interfaces was not implemented. Index: AvalonProxyFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest/Attic/AvalonProxyFixture.cs,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** AvalonProxyFixture.cs 27 Sep 2004 03:42:02 -0000 1.1.2.1 --- AvalonProxyFixture.cs 4 Oct 2004 01:42:45 -0000 1.1.2.2 *************** *** 31,35 **** s = sessions.OpenSession(); ! ap = (AvalonProxy)s.Load( typeof(AvalonProxyImpl), ap.Id ); Assert.IsFalse( NHibernate.IsInitialized( ap ) ); int id = ap.Id; --- 31,35 ---- s = sessions.OpenSession(); ! ap = (AvalonProxy)s.Load( typeof(AvalonProxyImpl), ap.Id ); Assert.IsFalse( NHibernate.IsInitialized( ap ) ); int id = ap.Id; *************** *** 42,45 **** --- 42,73 ---- } + [Test] + public void ProxySerialize() + { + ISession s = sessions.OpenSession(); + AvalonProxy ap = new AvalonProxyImpl(); + ap.Id = 1; + ap.Name = "first proxy"; + s.Save( ap ); + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + ap = (AvalonProxy)s.Load( typeof(AvalonProxyImpl), ap.Id ); + Assert.AreEqual( 1, ap.Id ); + s.Disconnect(); + + // serialize and then deserialize the session. + System.IO.Stream stream = new System.IO.MemoryStream(); + System.Runtime.Serialization.IFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); + formatter.Serialize(stream, s); + stream.Position = 0; + s = (ISession)formatter.Deserialize(stream); + stream.Close(); + + + s.Close(); + } + } } |