Refactored the Kernel registration fluent interface to be more readable, better suppo...
[castle.git] / Facilities / ActiveRecordIntegration / Castle.Facilities.ActiveRecordIntegration.Tests / AbstractActiveRecordTest.cs
blobb2be32c559c4d9ce3247654835d3c67f2450bf1c
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.ActiveRecordIntegration.Tests
17 using System;
18 using Castle.Core.Resource;
19 using Castle.Windsor;
21 using Castle.ActiveRecord;
22 using Castle.Windsor.Configuration.Interpreters;
23 using NUnit.Framework;
25 using Castle.Facilities.ActiveRecordIntegration.Tests.Model;
26 using Castle.Facilities.AutomaticTransactionManagement;
29 public class AbstractActiveRecordTest
31 protected IWindsorContainer container;
33 [TestFixtureSetUp]
34 public void Init()
36 container = new WindsorContainer(new XmlInterpreter(new ConfigResource()));
38 container.AddFacility("transactionfacility", new TransactionFacility() );
39 container.AddFacility("arfacility", new ActiveRecordFacility() );
41 container.AddComponent( "blog.service", typeof(BlogService) );
42 container.AddComponent( "post.service", typeof(PostService) );
43 container.AddComponent( "first.service", typeof(FirstService) );
44 container.AddComponent( "wiring.service", typeof(WiringSession) );
46 Recreate();
49 [TestFixtureTearDown]
50 public void Terminate()
52 try
54 ActiveRecordStarter.DropSchema();
56 catch(Exception)
61 container.Dispose();
64 protected void Recreate()
66 ActiveRecordStarter.CreateSchema();