Пример #1
0
        public void ApplyUsageRulesToFoldersToFindAssemblies()
        {
            //this can fail due to restrictions or depenendcies... need to look at using MEF to load them all.
//            Assembly s = Assembly.LoadFrom(@"C:\hoh_code\Bailey\bailey\trunk\source\Bailey.DAL\bin\Debug\Bailey.Common.dll");
//            Assembly.UnsafeLoadFrom(@"C:\Windows\System32\browser.dll");

            IList <string> assemblyFolders = new List <string>()
            {
                Dir4, Dir8, Dir9
            };
            IList <Assembly> assemblies = new List <Assembly>();

            AssemblyLocator.UsageRules.UsageRuleAssemblyApplicator assemblyApplicator = new AssemblyLocator.UsageRules.UsageRuleAssemblyApplicator();
            assemblyApplicator.FindAllAssembiesForGivenFolders(assemblyFolders, assemblies);

            Assert.AreEqual(1, assemblies.Count);
            IList <string> assemblyNames = assemblies.Select(x => x.FullName).ToList();

            Assert.Contains(cabinet.FullName, assemblyNames.ToArray());
        }
        public void ApplyUsageRulesToFoldersToFindAssemblies()
        {
            //this can fail due to restrictions or depenendcies... need to look at using MEF to load them all.
            //            Assembly s = Assembly.LoadFrom(@"C:\hoh_code\Bailey\bailey\trunk\source\Bailey.DAL\bin\Debug\Bailey.Common.dll");
            //            Assembly.UnsafeLoadFrom(@"C:\Windows\System32\browser.dll");

            IList<string> assemblyFolders = new List<string>() { Dir4, Dir8, Dir9 };
            IList<Assembly> assemblies = new List<Assembly>();

            AssemblyLocator.UsageRules.UsageRuleAssemblyApplicator assemblyApplicator = new AssemblyLocator.UsageRules.UsageRuleAssemblyApplicator();
            assemblyApplicator.FindAllAssembiesForGivenFolders(assemblyFolders, assemblies);

            Assert.AreEqual(1, assemblies.Count);
            IList<string> assemblyNames = assemblies.Select(x => x.FullName).ToList();
            Assert.Contains(cabinet.FullName, assemblyNames.ToArray());
        }