Refactored the Kernel registration fluent interface to be more readable, better suppo...
[castle.git] / Facilities / NHibernateIntegration / Castle.Facilities.NHibernateIntegration.Tests / AbstractNHibernateTestCase.cs
blobda4630bf4bae88cf0084eef90be12571efdc5f67
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.Facilities.NHibernateIntegration.Tests
17 using Castle.Core.Resource;
18 using Castle.Windsor;
19 using Castle.Windsor.Configuration.Interpreters;
20 using NHibernate.Cfg;
21 using NHibernate.Tool.hbm2ddl;
22 using NUnit.Framework;
24 public abstract class AbstractNHibernateTestCase
26 protected IWindsorContainer container;
28 [SetUp]
29 public void Init()
31 container = new WindsorContainer(new XmlInterpreter(new ConfigResource()));
33 // Reset tables
35 Configuration cfg1 = (Configuration) container[ "sessionFactory1.cfg" ];
36 SchemaExport export1 = new SchemaExport(cfg1);
38 Configuration cfg2 = (Configuration) container[ "sessionFactory2.cfg" ];
39 SchemaExport export2 = new SchemaExport(cfg2);
41 export1.Create(false, true);
42 export2.Create(false, true);
44 ConfigureContainer();
47 protected virtual void ConfigureContainer()
52 [TearDown]
53 public void Dispose()
55 Configuration cfg1 = (Configuration) container[ "sessionFactory1.cfg" ];
56 SchemaExport export1 = new SchemaExport(cfg1);
58 Configuration cfg2 = (Configuration) container[ "sessionFactory2.cfg" ];
59 SchemaExport export2 = new SchemaExport(cfg2);
61 export2.Drop(false, true);
62 export1.Drop(false, true);
64 container.Dispose();
66 container = null;