Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/Subclass
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6714/src/NHibernate.Test/Subclass
Modified Files:
SubclassExtendsFixture.cs SubclassFixture.cs
Log Message:
Major TestCase refactoring:
- schema is now always set up in TestCase.TestFixtureSetUp and dropped in TestCase.TestFixtureTearDown
- added property Mappings and MappingsAssembly to specify mappings declaratively instead of manually calling SchemaExport
! all tests now have to clean up the database after themselves! This is checked in TestCase.TearDown.
- test cases not cleaning up the database were fixed
- SetUp and TearDown are non-virtual, test writers are supposed to override OnSetUp and OnTearDown instead.
- Added TypeFixtureBase for type-related fixtures to reduce code duplication somewhat
These modifications sped up tests 10 times on my machine.
Index: SubclassFixture.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/Subclass/SubclassFixture.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SubclassFixture.cs 5 May 2005 19:28:03 -0000 1.2
--- SubclassFixture.cs 6 May 2005 23:41:19 -0000 1.3
***************
*** 15,23 ****
private DateTime testDateTime = new DateTime(2003, 8, 16);
private DateTime updateDateTime = new DateTime(2003, 8, 17);
!
! [SetUp]
! public virtual void SetUp()
{
! ExportSchema( new string[] { "Subclass.Subclass.hbm.xml" }, true, "NHibernate.Test" );
}
--- 15,30 ----
private DateTime testDateTime = new DateTime(2003, 8, 16);
private DateTime updateDateTime = new DateTime(2003, 8, 17);
!
! protected override string MappingsAssembly
{
! get { return "NHibernate.Test"; }
! }
!
! protected override IList Mappings
! {
! get
! {
! return new string[] { "Subclass.Subclass.hbm.xml" };
! }
}
***************
*** 151,154 ****
--- 158,167 ----
Assert.AreEqual( typeof(SubclassOne), list[0].GetType(), "should be one" );
s.Close();
+
+ s = OpenSession();
+ s.Delete( one1 );
+ s.Delete( base1 );
+ s.Flush();
+ s.Close();
}
Index: SubclassExtendsFixture.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/Subclass/SubclassExtendsFixture.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SubclassExtendsFixture.cs 10 Dec 2004 16:40:04 -0000 1.1
--- SubclassExtendsFixture.cs 6 May 2005 23:41:19 -0000 1.2
***************
*** 17,32 ****
public class SubclassExtendsFixture : SubclassFixture
{
! [SetUp]
! public override void SetUp()
{
! // order is important! The base classes must be configured before
! // the subclasses.
! ArrayList files = new ArrayList();
! files.Add( "Subclass.Subclass.Base.hbm.xml" );
! files.Add( "Subclass.Subclass.One.hbm.xml" );
!
! ExportSchema( files, true, "NHibernate.Test" );
}
-
}
}
--- 17,33 ----
public class SubclassExtendsFixture : SubclassFixture
{
! protected override IList Mappings
{
! get
! {
! // order is important! The base classes must be configured before
! // the subclasses.
! return new string[]
! {
! "Subclass.Subclass.Base.hbm.xml",
! "Subclass.Subclass.One.hbm.xml"
! };
! }
}
}
}
|