1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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
.Configuration
17 using Castle
.Core
.Configuration
;
18 using Castle
.Core
.Resource
;
19 using Castle
.MicroKernel
.SubSystems
.Configuration
;
20 using Castle
.Windsor
.Configuration
.Interpreters
;
21 using NUnit
.Framework
;
24 /// Summary description for AppDomainConfigSourceTestCase.
27 public class AppDomainConfigSourceTestCase
30 public void ProperDeserialization()
32 DefaultConfigurationStore store
= new DefaultConfigurationStore();
33 XmlInterpreter interpreter
= new XmlInterpreter(new ConfigResource());
34 interpreter
.ProcessResource(interpreter
.Source
, store
);
36 Assert
.AreEqual(2, store
.GetFacilities().Length
);
37 Assert
.AreEqual(2, store
.GetComponents().Length
);
39 IConfiguration config
= store
.GetFacilityConfiguration("testidengine");
40 IConfiguration childItem
= config
.Children
["item"];
41 Assert
.IsNotNull(childItem
);
42 Assert
.AreEqual("value", childItem
.Value
);
44 config
= store
.GetFacilityConfiguration("testidengine2");
45 Assert
.IsNotNull(config
);
46 Assert
.AreEqual("value within CDATA section", config
.Value
);
48 config
= store
.GetComponentConfiguration("testidcomponent1");
49 childItem
= config
.Children
["item"];
50 Assert
.IsNotNull(childItem
);
51 Assert
.AreEqual("value1", childItem
.Value
);
53 config
= store
.GetComponentConfiguration("testidcomponent2");
54 childItem
= config
.Children
["item"];
55 Assert
.IsNotNull(childItem
);
56 Assert
.AreEqual("value2", childItem
.Value
);