Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/CompositeId
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6714/src/NHibernate.Test/CompositeId
Modified Files:
ClassWithCompositeIdFixture.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: ClassWithCompositeIdFixture.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/CompositeId/ClassWithCompositeIdFixture.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ClassWithCompositeIdFixture.cs 5 May 2005 19:27:53 -0000 1.2
--- ClassWithCompositeIdFixture.cs 6 May 2005 23:41:16 -0000 1.3
***************
*** 19,31 ****
private Id id;
private Id secondId;
!
! [SetUp]
! public void SetUp()
{
- ExportSchema( new string[] { "CompositeId.ClassWithCompositeId.hbm.xml" }, true, "NHibernate.Test" );
id = new Id("stringKey", 3, firstDateTime);
secondId = new Id("stringKey2", 5, secondDateTime);
}
/// <summary>
/// Test the basic CRUD operations for a class with a Composite Identifier
--- 19,52 ----
private Id id;
private Id secondId;
!
! protected override string MappingsAssembly
! {
! get { return "NHibernate.Test"; }
! }
!
! protected override IList Mappings
! {
! get
! {
! return new string[] { "CompositeId.ClassWithCompositeId.hbm.xml" };
! }
! }
!
! protected override void OnSetUp()
{
id = new Id("stringKey", 3, firstDateTime);
secondId = new Id("stringKey2", 5, secondDateTime);
}
+ protected override void OnTearDown()
+ {
+ using( ISession s = sessions.OpenSession() )
+ {
+ s.Delete( "from ClassWithCompositeId" );
+ s.Flush();
+ }
+ }
+
+
/// <summary>
/// Test the basic CRUD operations for a class with a Composite Identifier
***************
*** 207,212 ****
s2.Close();
}
-
-
}
}
--- 228,231 ----
|