コード例 #1
0
        public override bool OnBeginRecipe(object currentValue, out object newValue)
        {
            if (currentValue == null)
            {
                ExpressionEvaluationService evaluator   = new ExpressionEvaluationService();
                IDictionaryService          dictservice = (IDictionaryService)GetService(typeof(IDictionaryService));

                string path = evaluator.Evaluate(
                    this._pathExpression,
                    new ServiceAdapterDictionary(dictservice)).ToString();

                WebConfigXmlParseModuleInfoStore store = new WebConfigXmlParseModuleInfoStore(path);
                WebModuleEnumerator moduleEnumerator   = new WebModuleEnumerator(store);

                IModuleInfo[] modules = moduleEnumerator.EnumerateModules();

                newValue = new ModuleInfoMapper().Translate(modules);

                return(true);
            }

            newValue = null;
            return(false);
        }
コード例 #2
0
        public void TranslateDependantModuleInfo()
        {
            DependantModuleInfo dependantModuleInfo = new DependantModuleInfo("Module1", "Module1.dll", "Module1");

            dependantModuleInfo.Dependencies = new ModuleDependency[1];

            ModuleDependency dependency = new ModuleDependency();

            dependency.Name = "ModuleDependency";

            dependantModuleInfo.Dependencies[0] = dependency;

            DependantModuleInfo[] modules = new DependantModuleInfo[1];
            modules[0] = dependantModuleInfo;

            GuidancePackageModuleInfo[] guidanceModules = new ModuleInfoMapper().Translate(modules);

            Assert.AreEqual(guidanceModules.Length, modules.Length);
            Assert.AreEqual(guidanceModules[0].Name, dependantModuleInfo.Name);
            Assert.AreEqual(guidanceModules[0].AssemblyName, dependantModuleInfo.AssemblyName);
            Assert.AreEqual(guidanceModules[0].VirtualPath, dependantModuleInfo.VirtualPath);
            Assert.AreEqual(guidanceModules[0].Dependencies.Length, dependantModuleInfo.Dependencies.Length);
            Assert.AreEqual(guidanceModules[0].Dependencies[0].Name, dependantModuleInfo.Dependencies[0].Name);
        }