public List <IComponent> Locate(string xmlFile) { List <IComponent> components = new List <IComponent>(); if (Log.IsDebugEnabled()) { Log.Debug("Locating components defined in XML resource " + xmlFile); } XDocument feedXML = XDocument.Load(xmlFile); IEnumerable <XElement> xmlComponentElements = from component in feedXML.Descendants("component") select component; foreach (XElement componentElement in xmlComponentElements) { Component component = new Component((string)componentElement.Attribute("Name"), UtilityToolbox.GetType((string)componentElement.Attribute("Type")), UtilityToolbox.GetScope((string)componentElement.Attribute("Scope"))); component.Fields = getFields(componentElement); components.Add(component); } return(components); }
public void GetScopeNullFailed() { Scope scope = UtilityToolbox.GetScope(null); Assert.Equal(scope, Scope.Singleton); }
public void GetScopeFailed() { Scope scope = UtilityToolbox.GetScope("InvalidScope"); Assert.Equal(scope, Scope.Singleton); }
public void GetScope() { Scope scope = UtilityToolbox.GetScope("Prototype"); Assert.Equal(scope, Scope.Prototype); }
public void GetTypeTest() { Type type = UtilityToolbox.GetType("Ndi.UnitTests.UtilityToolboxTest"); Assert.Equal(type, typeof(UtilityToolboxTest)); }
public UtilityToolboxTest() { utilityToolbox = new UtilityToolbox(); }