From: Sergey K. <jus...@us...> - 2005-05-06 23:41:58
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest/Docs/Associations/BiM21 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6714/src/NHibernate.Test/NHSpecificTest/Docs/Associations/BiM21 Modified Files: Fixture.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: Fixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest/Docs/Associations/BiM21/Fixture.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Fixture.cs 5 May 2005 19:27:55 -0000 1.2 --- Fixture.cs 6 May 2005 23:41:18 -0000 1.3 *************** *** 10,44 **** public class Fixture : TestCase { ! #region NUnit.Framework.TestFixture Members ! ! [TestFixtureSetUp] ! public void TestFixtureSetUp() ! { ! ExportSchema( new string[] { "NHSpecificTest.Docs.Associations.BiM21.Mappings.hbm.xml"}, true, "NHibernate.Test" ); ! } ! ! [SetUp] ! public void SetUp() ! { ! // there are test in here where we don't need to resetup the ! // tables - so only set the tables up once ! } ! ! [TearDown] ! public override void TearDown() { ! //base.TearDown (); } ! [TestFixtureTearDown] ! public void TestFixtureTearDown() { ! // only do this at the end of the test fixture ! base.TearDown(); } - #endregion - - [Test] public void TestCorrectUse() --- 10,26 ---- public class Fixture : TestCase { ! protected override string MappingsAssembly { ! get { return "NHibernate.Test"; } } ! protected override System.Collections.IList Mappings { ! get ! { ! return new string[] { "NHSpecificTest.Docs.Associations.BiM21.Mappings.hbm.xml"}; ! } } [Test] public void TestCorrectUse() |