From: Sergey K. <jus...@us...> - 2005-05-06 23:41:58
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/JoinedSubclass In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6714/src/NHibernate.Test/JoinedSubclass Modified Files: JoinedSubclassExtendsFixture.cs JoinedSubclassFixture.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: JoinedSubclassFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/JoinedSubclass/JoinedSubclassFixture.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** JoinedSubclassFixture.cs 5 May 2005 19:27:55 -0000 1.4 --- JoinedSubclassFixture.cs 6 May 2005 23:41:17 -0000 1.5 *************** *** 14,27 **** public class JoinedSubclassFixture : TestCase { ! private DateTime testDateTime = new DateTime(2003, 8, 16); ! private DateTime updateDateTime = new DateTime(2003, 8, 17); ! ! [SetUp] ! public virtual void SetUp() { ! ExportSchema( new string[] { "JoinedSubclass.JoinedSubclass.hbm.xml" }, true, "NHibernate.Test" ); } [Test] public void TestJoinedSubclass() --- 14,34 ---- public class JoinedSubclassFixture : TestCase { + protected override string MappingsAssembly + { + get { return "NHibernate.Test"; } + } ! protected override IList Mappings { ! get ! { ! return new string[] { "JoinedSubclass.JoinedSubclass.hbm.xml" }; ! } } + + private DateTime testDateTime = new DateTime(2003, 8, 16); + private DateTime updateDateTime = new DateTime(2003, 8, 17); + [Test] public void TestJoinedSubclass() Index: JoinedSubclassExtendsFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/JoinedSubclass/JoinedSubclassExtendsFixture.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JoinedSubclassExtendsFixture.cs 10 Dec 2004 16:40:03 -0000 1.1 --- JoinedSubclassExtendsFixture.cs 6 May 2005 23:41:17 -0000 1.2 *************** *** 17,33 **** public class JoinedSubclassExtendsFixture : JoinedSubclassFixture { ! [SetUp] ! public override void SetUp() { ! // order is important! The base classes must be configured before ! // the subclasses. ! ArrayList files = new ArrayList(); ! files.Add( "JoinedSubclass.JoinedSubclass.Person.hbm.xml" ); ! files.Add( "JoinedSubclass.JoinedSubclass.Employee.hbm.xml" ); ! files.Add( "JoinedSubclass.JoinedSubclass.Customer.hbm.xml" ); ! ! ExportSchema( files, true, "NHibernate.Test" ); } - } } --- 17,34 ---- public class JoinedSubclassExtendsFixture : JoinedSubclassFixture { ! protected override IList Mappings { ! get ! { ! // order is important! The base classes must be configured before ! // the subclasses. ! return new string[] ! { ! "JoinedSubclass.JoinedSubclass.Person.hbm.xml", ! "JoinedSubclass.JoinedSubclass.Employee.hbm.xml", ! "JoinedSubclass.JoinedSubclass.Customer.hbm.xml" ! }; ! } } } } |