/// <summary> /// Constructor /// </summary> /// <param name="configFile">XML configuration file to initialise from</param> public PropertyResolvingWindsorContainer(string configFile) : base(new XmlInterpreter(configFile)) { Interpreter = new PropertiesInterpreter(configFile); Kernel.AddSubSystem(PropertiesSubSystem.SubSystemKey, new PropertiesSubSystem(Interpreter)); }
public void Get_Resolver_Throws_Exception_If_ProcessResource_Was_Not_Called() { // arrange EmbeddedResourceUtil.ExportToPath("Castle.Windsor.Extensions.Test.data", "castle.config", Path.GetTempPath()); string path = Path.GetTempPath() + "\\castle.config"; PropertiesInterpreter interpreter = new PropertiesInterpreter(path); ConfigurationProcessingException expected = new ConfigurationProcessingException("Properties file has not been processed yet. Have you missed calling PropertiesInterpreter.ProcessResource(IResource,IConfigurationStore,IKernel)"); ConfigurationProcessingException actual = null; // act try { IPropertyResolver resolver = interpreter.Resolver; } catch (ConfigurationProcessingException e) { actual = e; } // assert Assert.IsNotNull(actual); Assert.AreEqual(expected.Message, actual.Message); }
public void Get_Resolver_DoesNot_Throw_Exception_If_ProcessResource_Was_Called() { // arrange EmbeddedResourceUtil.ExportToPath("Castle.Windsor.Extensions.Test.data", "castle.config", Path.GetTempPath()); string path = Path.GetTempPath() + "\\castle.config"; PropertiesInterpreter interpreter = new PropertiesInterpreter(path); WindsorContainer container = new WindsorContainer(); interpreter.ProcessResource(interpreter.Source, container.Kernel.ConfigurationStore, container.Kernel); ConfigurationProcessingException actual = null; IPropertyResolver resolver = null; // act try { resolver = interpreter.Resolver; } catch (ConfigurationProcessingException e) { actual = e; } // assert Assert.IsNull(actual); Assert.IsNotNull(resolver); }
/// <summary> /// Constructor (initialises the <see cref="IWindsorContainer" /> from the app.config/web.config /// file) /// </summary> public PropertyResolvingWindsorContainer() { Interpreter = new PropertiesInterpreter(); Kernel.AddSubSystem(PropertiesSubSystem.SubSystemKey, new PropertiesSubSystem(Interpreter)); }