Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20559/NHibernate.Test
Modified Files:
SimpleTest.cs
Log Message:
added an older test case back in.
Index: SimpleTest.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/SimpleTest.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SimpleTest.cs 10 Feb 2004 19:16:54 -0000 1.1
--- SimpleTest.cs 16 May 2004 03:49:36 -0000 1.2
***************
*** 23,26 ****
--- 23,27 ----
}
+ [Test]
public void TestCRUD()
{
***************
*** 108,112 ****
! private void OldTestCase()
{
DateTime now = DateTime.Now;
--- 109,114 ----
! [Test]
! public void SetPropertiesOnQuery()
{
DateTime now = DateTime.Now;
***************
*** 116,119 ****
--- 118,122 ----
// create a new
+ long key = 10;
Simple simple = new Simple();
simple.Name = "Simple 1";
***************
*** 122,161 ****
simple.Count = 99;
! s.Save(simple, 10);
t.Commit();
- s.Close();
-
! // BUG: It looks like the problem is coming here because we now have the sample Entity loaded
! // twice in the entries field for this Session. I don't understand why that would happen
! // because a Dictionary should not allow a key to be in there twice...
IQuery q = s.CreateQuery("from s in class Simple where s.Name=:Name and s.Count=:Count");
q.SetProperties(simple);
Simple loadedSimple = (Simple)q.List()[0];
! // Check if save failed
! Assertion.AssertEquals("Save failed", 99, simple.Count);
! Assertion.AssertEquals("Save failed", "Simple 1", simple.Name);
! Assertion.AssertEquals("Save failed", "Street 12", simple.Address);
! Assertion.AssertEquals("Save failed", now.ToString(), simple.Date.ToString());
! // Check if load failed
! Assertion.AssertNotNull("Unable to load object", loadedSimple);
! Assertion.AssertEquals("Load failed", simple.Count, loadedSimple.Count);
! Assertion.AssertEquals("Load failed", simple.Name, loadedSimple.Name);
! Assertion.AssertEquals("Load failed", simple.Address, loadedSimple.Address);
! Assertion.AssertEquals("Load failed", simple.Date.ToString(), loadedSimple.Date.ToString());
!
! // The INSERT, UPDATE amd SELECT are performed due to some hacks,
! // see Impl\SessionImpl.cs class AdoHack
! // Btw: when something goes wrong, the transaction remains opened ;-)
!
! // When you set a breakpoint at this line, you'll see the record in the database
! ((Transaction.Transaction)t).AdoTransaction.Commit();
! //s.Delete(simple);
! //
! // note: this line fails!!!!
! //
t.Commit();
s.Close();
--- 125,146 ----
simple.Count = 99;
! s.Save(simple, key);
t.Commit();
! t = s.BeginTransaction();
!
IQuery q = s.CreateQuery("from s in class Simple where s.Name=:Name and s.Count=:Count");
q.SetProperties(simple);
Simple loadedSimple = (Simple)q.List()[0];
! Assert.AreEqual(key, loadedSimple.Key);
! Assert.AreEqual(99, loadedSimple.Count);
! Assert.AreEqual("Simple 1", loadedSimple.Name);
! Assert.AreEqual("Street 12", loadedSimple.Address);
! Assert.AreEqual(now.ToString(), loadedSimple.Date.ToString());
! s.Delete(simple);
!
t.Commit();
s.Close();
|