From: <pa...@us...> - 2011-07-22 05:25:07
|
Revision: 5989 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5989&view=rev Author: patearl Date: 2011-07-22 05:25:00 +0000 (Fri, 22 Jul 2011) Log Message: ----------- Tests: Use standard cleanup pattern for test setup failures. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/TestCase.cs Modified: trunk/nhibernate/src/NHibernate.Test/TestCase.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/TestCase.cs 2011-07-22 02:13:03 UTC (rev 5988) +++ trunk/nhibernate/src/NHibernate.Test/TestCase.cs 2011-07-22 05:25:00 UTC (rev 5989) @@ -84,7 +84,6 @@ [TestFixtureSetUp] public void TestFixtureSetUp() { - bool schemaCreated = false; try { Configure(); @@ -94,19 +93,22 @@ } CreateSchema(); - schemaCreated = true; - BuildSessionFactory(); - if (!AppliesTo(sessions)) + try { + BuildSessionFactory(); + if (!AppliesTo(sessions)) + { + Assert.Ignore(GetType() + " does not apply with the current session-factory configuration"); + } + } + catch + { DropSchema(); - Cleanup(); - Assert.Ignore(GetType() + " does not apply with the current session-factory configuration"); + throw; } } catch (Exception e) { - if (schemaCreated) - DropSchema(); Cleanup(); log.Error("Error while setting up the test fixture", e); throw; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |