From: Michael D. <mik...@us...> - 2004-08-09 03:40:54
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12072/NHibernate.Test Modified Files: MasterDetailTest.cs Log Message: Serialize test now works as expected. Index: MasterDetailTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/MasterDetailTest.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MasterDetailTest.cs 6 Aug 2004 15:37:13 -0000 1.8 --- MasterDetailTest.cs 9 Aug 2004 03:40:41 -0000 1.9 *************** *** 281,285 **** [Test] - //[Ignore("ISession not fully serializable - http://jira.nhibernate.org:8080/browse/NH-60")] public void Serialization() { --- 281,284 ---- *************** *** 305,313 **** System.IO.MemoryStream stream = new System.IO.MemoryStream(); System.Runtime.Serialization.Formatters.Binary.BinaryFormatter f = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); ! // f.Serialize(stream, s); ! // stream.Position = 0; ! // Console.WriteLine(stream.Length); ! //TODO ! // s = (Session) new ObjectInputStream( new ByteArrayInputStream(bytes) ).readObject(); s.Reconnect(); Master m2 = (Master) s.Load(typeof(Master), mid); --- 304,313 ---- System.IO.MemoryStream stream = new System.IO.MemoryStream(); System.Runtime.Serialization.Formatters.Binary.BinaryFormatter f = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); ! f.Serialize(stream, s); ! stream.Position = 0; ! ! s = (ISession)f.Deserialize(stream); ! stream.Close(); ! s.Reconnect(); Master m2 = (Master) s.Load(typeof(Master), mid); *************** *** 321,325 **** s.Delete(d); } ! catch (Exception e) {} } s.Delete(m2); --- 321,328 ---- s.Delete(d); } ! catch (Exception e) ! { ! Assert.IsTrue( e is Exception, "just getting rid of a compiler warning." ); ! } } s.Delete(m2); *************** *** 332,341 **** s.Flush(); s.Disconnect(); ! // stream = new System.IO.MemoryStream(); ! // f.Serialize(stream, s); ! // stream.Position = 0; ! // Console.WriteLine(stream.Length); ! //TODO ! // s = (Session) new ObjectInputStream( new ByteArrayInputStream(bytes) ).readObject(); s.Reconnect(); s.Delete( s.Load(typeof(Master), mid) ); --- 335,345 ---- s.Flush(); s.Disconnect(); ! stream = new System.IO.MemoryStream(); ! f.Serialize(stream, s); ! stream.Position = 0; ! ! s = (ISession)f.Deserialize(stream); ! stream.Close(); ! s.Reconnect(); s.Delete( s.Load(typeof(Master), mid) ); *************** *** 357,360 **** --- 361,368 ---- return; } + finally + { + stream.Close(); + } Assert.IsTrue(false, "serialization should have failed"); } |