Removing "using Test;"
[castle.git] / InversionOfControl / Castle.Windsor.Tests / PropertiesInspectionBehaviorTestCase.cs
blob1c1a553782acf266580f0912ea0d2b24ff95409f
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.Windsor.Tests
17 using Castle.MicroKernel;
18 using Castle.Windsor.Tests.Components;
19 using NUnit.Framework;
21 [TestFixture]
22 public class PropertiesInspectionBehaviorTestCase
24 [Test]
25 public void PropertiesInspectionTestCase()
27 IWindsorContainer container;
29 container = new WindsorContainer(ConfigHelper.ResolveConfigPath("propertyInspectionBehavior.xml"));
31 ExtendedComponentWithProperties comp;
33 comp = (ExtendedComponentWithProperties) container["comp1"]; // None
34 Assert.IsNull(comp.Prop1);
35 Assert.AreEqual(0, comp.Prop2);
36 Assert.AreEqual(0, comp.Prop3);
38 comp = (ExtendedComponentWithProperties) container["comp2"]; // All
39 Assert.IsNotNull(comp.Prop1);
40 Assert.AreEqual(1, comp.Prop2);
41 Assert.AreEqual(2, comp.Prop3);
43 comp = (ExtendedComponentWithProperties) container["comp3"]; // DeclaredOnly
44 Assert.IsNull(comp.Prop1);
45 Assert.AreEqual(0, comp.Prop2);
46 Assert.AreEqual(2, comp.Prop3);
49 [Test,
50 ExpectedException(typeof(KernelException),
51 "Error on properties inspection. Could not convert the inspectionBehavior attribute value into an expected enum value. Value found is 'Invalid' while possible values are 'Undefined,None,All,DeclaredOnly'"
53 public void InvalidOption()
55 IWindsorContainer container;
57 container = new WindsorContainer(ConfigHelper.ResolveConfigPath("propertyInspectionBehaviorInvalid.xml"));