Exemplo n.º 1
0
        public ContainerContext(IContainerConfiguration configuration, IClassWrapperCreator classWrapperCreator)
        {
            Configuration       = configuration;
            ClassWrapperCreator = classWrapperCreator;
            ITypesHelper typesHelper = new TypesHelper();

            var funcHelper = new FuncHelper();

            FuncBuilder = new FuncBuilder();
            var classCreator        = new ClassCreator(funcHelper);
            var constructorSelector = new ConstructorSelector();

            CreationContext = new CreationContext(classCreator, constructorSelector, classWrapperCreator);

            var implementationTypesCollection = new ImplementationTypesCollection(configuration.GetTypesToScan(), typesHelper);

            ImplementationCache = new ImplementationCache();
            IAbstractionsCollection abstractionsCollection = new AbstractionsCollection(implementationTypesCollection, ImplementationCache);

            ImplementationConfigurationCache = new ImplementationConfigurationCache(); //l
            var factory = new AutoAbstractionConfigurationFactory(typesHelper, abstractionsCollection, ImplementationConfigurationCache);

            AbstractionConfigurationCollection = new AbstractionConfigurationCollection(factory);
            AbstractionConfigurationCollection.Add(typeof(IContainer), new StupidAbstractionConfiguration(new ContainerImplementationConfiguration()));
        }
 public override void SetUp()
 {
     base.SetUp();
     implementationTypesCollection = GetMock <IImplementationTypesCollection>();
     implementationCache           = GetMock <IImplementationCache>();
     abstractionsCollection        = new AbstractionsCollection(implementationTypesCollection, implementationCache);
 }
        public CompositeContainerContext(IContainerConfiguration configuration, IClassWrapperCreator classWrapperCreator,
                                         IContainerSelector containerSelector)
        {
            this.Configuration  = configuration;
            ClassWrapperCreator = classWrapperCreator;
            typesHelper         = new TypesHelper();

            var funcHelper = new FuncHelper();

            FuncBuilder = new FuncBuilder();
            var classCreator        = new ClassCreator(funcHelper);
            var constructorSelector = new ConstructorSelector();

            CreationContext = new CreationContext(classCreator, constructorSelector, classWrapperCreator);

            var implementationTypesCollection = new ImplementationTypesCollection(configuration, typesHelper);

            ImplementationCache              = new ImplementationCache();
            abstractionsCollection           = new AbstractionsCollection(implementationTypesCollection, ImplementationCache);
            ImplementationConfigurationCache = new ImplementationConfigurationCache();
            var factory = new AutoAbstractionConfigurationFactory(typesHelper, abstractionsCollection,
                                                                  ImplementationConfigurationCache);

            compositeCollection = new CompositeCollection(new[] { new AbstractionConfigurationCollection(factory) },
                                                          containerSelector);
            compositeCollection.Add(typeof(IContainer),
                                    new StupidAbstractionConfiguration(
                                        new ContainerImplementationConfiguration()));
        }