Beispiel #1
0
        protected override void Load(ContainerBuilder builder)
        {
            var assemblies = AssemblyTypeResolver.GetAllAssembliesFromAppDomain().ToArray();

            builder.RegisterAssemblyTypes(assemblies)
            .AsClosedTypesOf(typeof(ScenarioFor <>));
            builder.RegisterAssemblyTypes(assemblies)
            .AsClosedTypesOf(typeof(ScenarioFor <,>));

            //builder.RegisterGeneric(typeof (ScenarioFor<>)).InstancePerLifetimeScope();
            //builder.RegisterGeneric(typeof (ScenarioFor<,>)).InstancePerLifetimeScope();

            var mockFactory = new MockDetector().FindAvailableMock();

            if (mockFactory == null)
            {
                builder.Register(c => new IocContainer(c.Resolve <ILifetimeScope>()))
                .As <IContainer>()
                .InstancePerLifetimeScope();
            }
            else
            {
                builder.Register(c => new AutoMockingContainer(mockFactory()))
                .As <IContainer>()
                .InstancePerLifetimeScope();
            }
        }
Beispiel #2
0
        private void RegisterScenarios(ContainerBuilder builder)
        {
            var assemblies = AssemblyTypeResolver.GetAllAssembliesFromAppDomain().ToArray();

            builder.RegisterAssemblyTypes(assemblies)
            .AsClosedTypesOf(typeof(ScenarioFor <>));
            builder.RegisterAssemblyTypes(assemblies)
            .AsClosedTypesOf(typeof(ScenarioFor <,>));
        }
Beispiel #3
0
        public AutofacDependencyResolver()
        {
            var assemblies = AssemblyTypeResolver.GetAllAssembliesFromAppDomain().ToArray();

            _containerBuilder.RegisterAssemblyModules(assemblies);
        }
Beispiel #4
0
 public NinjectDependencyResolver()
 {
     var assemblies = AssemblyTypeResolver.GetAllAssembliesFromAppDomain().ToArray();
     // how to register all modules in Ninject
     //_containerBuilder.RegisterAssemblyModules(assemblies);
 }