Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public void GetScopeNullFailed()
        {
            Scope scope = UtilityToolbox.GetScope(null);

            Assert.Equal(scope, Scope.Singleton);
        }
Esempio n. 3
0
        public void GetScopeFailed()
        {
            Scope scope = UtilityToolbox.GetScope("InvalidScope");

            Assert.Equal(scope, Scope.Singleton);
        }
Esempio n. 4
0
        public void GetScope()
        {
            Scope scope = UtilityToolbox.GetScope("Prototype");

            Assert.Equal(scope, Scope.Prototype);
        }
Esempio n. 5
0
        public void GetTypeTest()
        {
            Type type = UtilityToolbox.GetType("Ndi.UnitTests.UtilityToolboxTest");

            Assert.Equal(type, typeof(UtilityToolboxTest));
        }
Esempio n. 6
0
 public UtilityToolboxTest()
 {
     utilityToolbox = new UtilityToolbox();
 }