Ejemplo n.º 1
0
        public void ReadConfig()
        {
            IAOPConfig cfg = AOPConfig.AOPConfiguration;
            XDoc       doc = XDoc.LoadFromFile(cfg.LoadAOPInfoPath());

            var xAdvisors = doc.NavigateToList(ADVISOR);

            foreach (var xAdvisor in xAdvisors)
            {
                string name = xAdvisor.GetStringValue(NAME_ATTR);
                Type   type = Reflector.LoadType(xAdvisor.GetStringValue(CLASS));
                _advisors.Add(name, type);
            }

            var xJoinPoints = doc.NavigateToList(JOIN_POINT);

            foreach (var xJoinPoint in xJoinPoints)
            {
                Position position    = EnumEx.Parse <Position>(xJoinPoint.GetStringValue(POSITION), true);
                string   pattern     = xJoinPoint.GetStringValue(PATTERN);
                string   advisorName = xJoinPoint.GetStringValue(EXECUTE);
                _jointPointDefinations.Add(new JoinPointDefination(position, advisorName, pattern));
            }
        }
Ejemplo n.º 2
0
        public void TestGetPath()
        {
            IAOPConfig cfg = AOPConfig.AOPConfiguration;

            Assert.AreEqual(Runtime.GetPath(@".\aop.xml"), cfg.LoadAOPInfoPath());
        }