public void GetAssemblies_Should_Return_Value_Assigned_To_Assembies_Property()
        {
            var assemblies = new Assembly[1];

            _underTest.Assemblies = assemblies;

            _underTest.GetAssemblies().Should().BeSameAs(assemblies);
        }
        private static void RegisterPlugins(ContainerBuilder builder)
        {
            var assemblies = AssemblyProvider.GetAssemblies().ToArray();

            builder.RegisterAssemblyTypes(assemblies).As <IPromotionEntryCodes>().InstancePerLifetimeScope();
            builder.RegisterAssemblyTypes(assemblies).As <IProductConverter>().InstancePerLifetimeScope();
            builder.RegisterAssemblyTypes(assemblies).As <IAdConverter>().InstancePerLifetimeScope();
            builder.RegisterAssemblyTypes(assemblies).As <IProductsAppender>().InstancePerLifetimeScope();
            builder.RegisterAssemblyTypes(assemblies).As <IAdsAppender>().InstancePerLifetimeScope();
        }
Exemplo n.º 3
0
        private IEnumerable <Assembly> GetAssemblies(string pluginFolder)
        {
            var rootPath = _pluginConfig.HostingEnvironment.ContentRootPath;

            if (pluginFolder.StartsWith("\\"))
            {
                pluginFolder = pluginFolder.Substring(1);
            }

            pluginFolder = System.IO.Path.Combine(rootPath, pluginFolder ?? "");

            if (!System.IO.Directory.Exists(pluginFolder))
            {
                System.IO.Directory.CreateDirectory(pluginFolder);
            }


            var assemblyProvider = new AssemblyProvider(pluginFolder, _pluginConfig.LoggerFactory);


            return(assemblyProvider.GetAssemblies());
        }