Skip to content
Browse files

Trying to find problem with FooBarTest.PersistCollections by duplicating

scenarios that could be causing it.  I believe it might be internal to
Castle.DynamicProxy but need to find a way to duplicate it with a less
complex scenario than the current test.


SVN: branches/alpha_avalon-proxy@1078
  • Loading branch information...
1 parent c7aedf5 commit 4e8979b28f75c1c60a35fd1425f162413714cd61 Mike Doerfler committed Nov 15, 2004
Showing with 21 additions and 0 deletions.
  1. +21 −0 src/NHibernate.Test/NHSpecificTest/AvalonProxyFixture.cs
View
21 src/NHibernate.Test/NHSpecificTest/AvalonProxyFixture.cs
@@ -69,5 +69,26 @@ public void ProxySerialize()
s.Close();
}
+ [Test]
+ public void SerializeNotFoundProxy()
+ {
+ ISession s = sessions.OpenSession();
+ // this does not actually exists in db
+ AvalonProxy notThere = (AvalonProxy)s.Load( typeof(AvalonProxyImpl), 5 );
+ Assert.AreEqual( 5, notThere.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();
+
+ Assert.IsNotNull( s.Load( typeof(AvalonProxyImpl), 5 ), "should be proxy - even though it doesn't exists in db" );
+ s.Close();
+ }
+
}
}

0 comments on commit 4e8979b

Please sign in to comment.
Something went wrong with that request. Please try again.