From: Peter S. <sz...@us...> - 2004-04-06 13:09:27
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10408/NHibernate.Test Modified Files: NHibernate.Test-1.1.csproj TestCase.cs Added Files: ABCTest.cs FooBarTest.cs Log Message: Another fix on incrementgenerator, a new TC in ABCTest, and the original hbms for some new tests. Testcase is going to be extended with executestatement for some nasty tricks in tests (deleting table/row, etc) --- NEW FILE: FooBarTest.cs --- using System; using NUnit.Framework; using NHibernate; using NHibernate.DomainModel; using System.Collections; namespace NHibernate.Test { [TestFixture] public class FooBarTest : TestCase { [SetUp] public void SetUp() { ExportSchema(new string[] { "FooBar.hbm.xml", "Baz.hbm.xml", "Qux.hbm.xml", "Glarch.hbm.xml", "Fum.hbm.xml", "Fumm.hbm.xml", "Fo.hbm.xml", "One.hbm.xml", "Many.hbm.xml", "Immutable.hbm.xml", "Fee.hbm.xml", "Vetoer.hbm.xml", "Holder.hbm.xml", "Location.hbm.xml", "Stuff.hbm.xml", "Container.hbm.xml", "Simple.hbm.xml", "XY.hbm.xml"}); } [Test] [Ignore("Maps haven't been converted yet")] public void FetchInitializedCollection() { ISession s = sessions.OpenSession(); /* Baz baz = new Baz(); ICollection fooBag = new ArrayList(); fooBag.add( new Foo() ); fooBag.add( new Foo() ); baz.setFooBag(fooBag); s.save(baz); fooBag = baz.getFooBag(); s.Find("from Baz baz left join fetch baz.fooBag"); Assert.IsTrue( NHibernate.IsInitialized(fooBag) ); Assert.IsTrue( fooBag==baz.getFooBag() ); Assert.IsTrue( baz.getFooBag().size()==2 ); s.Close(); s = sessions.OpenSession(); baz = (Baz) s.load( typeof(Baz), baz.getCode() ); Object bag = baz.getFooBag(); Assert.IsFalse( NHibernate.IsInitialized(bag) ); s.Find("from Baz baz left join fetch baz.fooBag"); Assert.IsFalse( NHibernate.IsInitialized(bag) ); Assert.IsTrue( bag==baz.getFooBag() ); Assert.IsTrue( baz.getFooBag().size()==2 ); s.Delete(baz); s.Flush();*/ s.Close(); } } } Index: TestCase.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/TestCase.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestCase.cs 22 Mar 2004 04:42:22 -0000 1.2 --- TestCase.cs 6 Apr 2004 12:56:39 -0000 1.3 *************** *** 1,4 **** --- 1,6 ---- using System; using System.Reflection; + using System.Data; + using System.Data.SqlClient; using NHibernate.DomainModel; *************** *** 36,41 **** } ! ! } } --- 38,45 ---- } ! public void ExecuteStatement(string sql) ! { ! SqlConnection conn = new SqlConnection(""); ! } } } --- NEW FILE: ABCTest.cs --- using System; using NUnit.Framework; using NHibernate; using NHibernate.DomainModel; using System.Collections; namespace NHibernate.Test { /// <summary> /// Summary description for ABCTest. /// </summary> [TestFixture] public class ABCTest : TestCase { [SetUp] public void SetUp() { ExportSchema(new string[] { "ABC.hbm.xml"}); } [Test] public void Subclassing() { ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); C1 c1 = new C1(); D d = new D(); d.amount =213.34f; c1.address = "foo bar"; c1.count = 23432; c1.name ="c1"; c1.d = d; s.Save(c1); d.id = c1.id; s.Save(d); Assert.IsTrue( s.Find("from c in class C2 where 1=1 or 1=1").Count ==0 ); t.Commit(); s.Close(); s = sessions.OpenSession(); t = s.BeginTransaction(); c1 = (C1) s.Load( typeof(A), c1.id ); Assert.IsTrue( c1.address.Equals("foo bar") && (c1.count==23432) && c1.name.Equals("c1") && c1.d.amount>213.3f ); t.Commit(); s.Close(); s = sessions.OpenSession(); t = s.BeginTransaction(); c1 = (C1) s.Load( typeof(B), c1.id ); Assert.IsTrue( c1.address.Equals("foo bar") && (c1.count==23432) && c1.name.Equals("c1") && c1.d.amount>213.3f ); t.Commit(); s.Close(); s = sessions.OpenSession(); t = s.BeginTransaction(); c1 = (C1) s.Load( typeof(C1), c1.id ); Assert.IsTrue( c1.address.Equals("foo bar") && (c1.count==23432) && c1.name.Equals("c1") && c1.d.amount>213.3f ); t.Commit(); s.Close(); s = sessions.OpenSession(); t = s.BeginTransaction(); s.Find("from b in class B"); t.Commit(); s.Close(); } } } Index: NHibernate.Test-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHibernate.Test-1.1.csproj,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** NHibernate.Test-1.1.csproj 6 Apr 2004 10:51:42 -0000 1.10 --- NHibernate.Test-1.1.csproj 6 Apr 2004 12:56:39 -0000 1.11 *************** *** 121,124 **** --- 121,129 ---- /> <File + RelPath = "ABCTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "App.config" BuildAction = "None" *************** *** 145,148 **** --- 150,158 ---- /> <File + RelPath = "FooBarTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "JoinedSubclassTest.cs" SubType = "Code" |