Fixing an issue with output parameters that are of type IntPtr
[castle.git] / InversionOfControl / Castle.MicroKernel.Tests / FacilityTestCase.cs
blob43e7c12ed5c417c65ead7516a1501e28f5d31dd6
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.MicroKernel.Tests
17 using Castle.Core.Configuration;
18 using Castle.MicroKernel.Tests.ClassComponents;
19 using NUnit.Framework;
21 [TestFixture]
22 public class FacilityTestCase
24 private const string FacilityKey = "testFacility";
25 private IKernel _kernel;
26 private HiperFacility _facility;
28 public FacilityTestCase()
32 [SetUp]
33 public void Init()
35 _kernel = new DefaultKernel();
37 IConfiguration confignode = new MutableConfiguration("facility");
38 IConfiguration facilityConf = confignode.Children.Add(new MutableConfiguration(FacilityKey));
39 _kernel.ConfigurationStore.AddFacilityConfiguration(FacilityKey, confignode);
41 _facility = new HiperFacility();
43 Assert.IsFalse(_facility.Initialized);
44 _kernel.AddFacility(FacilityKey, _facility);
47 [Test]
48 public void Creation()
50 IFacility facility = _kernel.GetFacilities()[0];
52 Assert.IsNotNull(facility);
53 Assert.AreSame(_facility, facility);
56 [Test]
57 public void LifeCycle()
59 Assert.IsFalse(_facility.Terminated);
61 IFacility facility = _kernel.GetFacilities()[0];
63 Assert.IsTrue(_facility.Initialized);
64 Assert.IsFalse(_facility.Terminated);
66 _kernel.Dispose();
68 Assert.IsTrue(_facility.Initialized);
69 Assert.IsTrue(_facility.Terminated);