From: Michael D. <mik...@us...> - 2004-06-04 12:02:56
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23194/NHibernate.Test Modified Files: FooBarTest.cs Log Message: Continued to work on the Domain Model and hbms for testing. Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** FooBarTest.cs 3 Jun 2004 19:03:40 -0000 1.22 --- FooBarTest.cs 4 Jun 2004 12:02:44 -0000 1.23 *************** *** 50,70 **** fooBag.Add( new Foo() ); fooBag.Add( new Foo() ); ! baz.fooBag=fooBag; s.Save(baz); ! fooBag = baz.fooBag; s.Find("from Baz baz left join fetch fooBag"); Assert.IsTrue( NHibernate.IsInitialized(fooBag) ); ! Assert.IsTrue( fooBag==baz.fooBag ); ! Assert.IsTrue( baz.fooBag.Count==2 ); s.Close(); s = sessions.OpenSession(); ! baz = (Baz) s.Load( typeof(Baz), baz.code ); ! Object bag = baz.fooBag; Assert.IsFalse( NHibernate.IsInitialized(bag) ); s.Find("from Baz baz left join fetch fooBag"); Assert.IsFalse( NHibernate.IsInitialized(bag) ); ! Assert.IsTrue( bag==baz.fooBag ); ! Assert.IsTrue( baz.fooBag.Count==2 ); s.Delete(baz); s.Flush(); --- 50,70 ---- fooBag.Add( new Foo() ); fooBag.Add( new Foo() ); ! baz.FooBag=fooBag; s.Save(baz); ! fooBag = baz.FooBag; s.Find("from Baz baz left join fetch fooBag"); Assert.IsTrue( NHibernate.IsInitialized(fooBag) ); ! Assert.IsTrue( fooBag==baz.FooBag ); ! Assert.IsTrue( baz.FooBag.Count==2 ); s.Close(); s = sessions.OpenSession(); ! baz = (Baz) s.Load( typeof(Baz), baz.Code ); ! Object bag = baz.FooBag; Assert.IsFalse( NHibernate.IsInitialized(bag) ); s.Find("from Baz baz left join fetch fooBag"); Assert.IsFalse( NHibernate.IsInitialized(bag) ); ! Assert.IsTrue( bag==baz.FooBag ); ! Assert.IsTrue( baz.FooBag.Count==2 ); s.Delete(baz); s.Flush(); *************** *** 83,87 **** ss.Add(new Sortable("bar"), null); ss.Add(new Sortable("baz"), null); ! b.sortablez = ss; s.Save(b); s.Flush(); --- 83,87 ---- ss.Add(new Sortable("bar"), null); ss.Add(new Sortable("baz"), null); ! b.Sortablez = ss; s.Save(b); s.Flush(); *************** *** 92,104 **** t = s.BeginTransaction(); IList result = s.CreateCriteria(typeof(Baz)) ! .AddOrder( Expression.Order.Asc("name") ) .List(); b = (Baz) result[0]; ! Assert.IsTrue( b.sortablez.Count==3 ); // compare the first item in the "Set" sortablez - can't reference // the first item using b.sortablez[0] because it thinks 0 is the // DictionaryEntry key - not the index. ! foreach(DictionaryEntry de in b.sortablez) { Assert.AreEqual( ((Sortable)de.Key).name, "bar"); --- 92,104 ---- t = s.BeginTransaction(); IList result = s.CreateCriteria(typeof(Baz)) ! .AddOrder( Expression.Order.Asc("Name") ) .List(); b = (Baz) result[0]; ! Assert.IsTrue( b.Sortablez.Count==3 ); // compare the first item in the "Set" sortablez - can't reference // the first item using b.sortablez[0] because it thinks 0 is the // DictionaryEntry key - not the index. ! foreach(DictionaryEntry de in b.Sortablez) { Assert.AreEqual( ((Sortable)de.Key).name, "bar"); *************** *** 112,120 **** s = sessions.OpenSession(); t = s.BeginTransaction(); ! result = s.CreateQuery("from Baz baz left join fetch sortablez order by baz.name asc") .List(); b = (Baz) result[0]; ! Assert.IsTrue( b.sortablez.Count==3 ); ! foreach(DictionaryEntry de in b.sortablez) { Assert.AreEqual( ((Sortable)de.Key).name, "bar"); --- 112,120 ---- s = sessions.OpenSession(); t = s.BeginTransaction(); ! result = s.CreateQuery("from Baz baz left join fetch sortablez order by baz.Name asc") .List(); b = (Baz) result[0]; ! Assert.IsTrue( b.Sortablez.Count==3 ); ! foreach(DictionaryEntry de in b.Sortablez) { Assert.AreEqual( ((Sortable)de.Key).name, "bar"); *************** *** 127,135 **** s = sessions.OpenSession(); t = s.BeginTransaction(); ! result = s.CreateQuery("from Baz baz order by baz.name asc") .List(); b = (Baz) result[0]; ! Assert.IsTrue( b.sortablez.Count==3 ); ! foreach(DictionaryEntry de in b.sortablez) { Assert.AreEqual( ((Sortable)de.Key).name, "bar"); --- 127,135 ---- s = sessions.OpenSession(); t = s.BeginTransaction(); ! result = s.CreateQuery("from Baz baz order by baz.Name asc") .List(); b = (Baz) result[0]; ! Assert.IsTrue( b.Sortablez.Count==3 ); ! foreach(DictionaryEntry de in b.Sortablez) { Assert.AreEqual( ((Sortable)de.Key).name, "bar"); *************** *** 160,166 **** list.Add(fee); } ! baz.fees = list; list = s.Find("from Foo foo, Baz baz left join fetch fees"); ! Assert.IsTrue( NHibernate.IsInitialized( ( (Baz) ( (object[]) list[0] )[1] ).fees ) ); s.Delete(foo); s.Delete(foo2); --- 160,166 ---- list.Add(fee); } ! baz.Fees = list; list = s.Find("from Foo foo, Baz baz left join fetch fees"); ! Assert.IsTrue( NHibernate.IsInitialized( ( (Baz) ( (object[]) list[0] )[1] ).Fees ) ); s.Delete(foo); s.Delete(foo2); *************** *** 176,180 **** Baz baz = new Baz(); IList list = new ArrayList(); ! baz.bazez =list; list.Add( new Baz() ); s.Save(baz); --- 176,180 ---- Baz baz = new Baz(); IList list = new ArrayList(); ! baz.Bazez =list; list.Add( new Baz() ); s.Save(baz); *************** *** 218,222 **** s = sessions.OpenSession(); Baz baz = (Baz) s.Load(typeof(Baz), id); ! IDictionary foos = baz.fooSet; Assert.IsTrue( foos.Count==0 ); Foo foo = new Foo(); --- 218,222 ---- s = sessions.OpenSession(); Baz baz = (Baz) s.Load(typeof(Baz), id); ! IDictionary foos = baz.FooSet; Assert.IsTrue( foos.Count==0 ); Foo foo = new Foo(); |