Пример #1
0
        public void CreateInstance_InnerContainerParamIsPresent()
        {
            var instance = DependencyContainerFactory.CreateInstance <Container>(
                new Container());

            Assert.NotNull(instance);
        }
Пример #2
0
        /// <summary>
        /// Initialize IOC container
        /// </summary>
        public void InitializeContainer()
        {
            var dependencies   = CreateDependencies();
            var unityContainer = DependencyContainerFactory.GetContainer(dependencies);

            Resolver.Container.UnityInjection(unityContainer);
        }
Пример #3
0
        public BootstrapperBaseTests()
        {
            DependencyContainerCreation dependencyContainerCreation = DependencyContainerFactory.Create();

            _dependencyRegistrar = dependencyContainerCreation.Registrar;
            _dependencyRetriever = dependencyContainerCreation.Retriever;
        }
Пример #4
0
 public void CreateInstance_ContainerDoesNotImplementBaseClass_ThrowsNonDependencyContainerException()
 {
     Assert.Throws <NonDependencyContainerException>(() =>
     {
         DependencyContainerFactory.CreateInstance <BaselessContainer>(
             new BaselessContainer());
     });
 }
Пример #5
0
 public void CreateInstance_InnerContainerParamIsNull_ThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         DependencyContainerFactory.CreateInstance <Container>(
             null);
     });
 }
Пример #6
0
        public static IDependencyContainer CreateInstance(
            bool allowReflectionEmit = false)
        {
            var instance = DependencyContainerFactory.CreateInstance <DryContainer>(
                CreateImplementation(allowReflectionEmit));

            return(instance);
        }
Пример #7
0
        protected BootstrapperBase()
        {
            DependencyContainerCreation dependencyContainerCreation = DependencyContainerFactory.Create();

            _dependencyRegistrar = dependencyContainerCreation.Registrar;
            _dependencyRetriever = dependencyContainerCreation.Retriever;

            Initialize();
        }
        public static IDependencyContainer CreateInstance(
            ILogService logService,
            bool allowReflectionEmit = false)
        {
            var instance = DependencyContainerFactory.CreateInstance <NinjectDependencyContainer>(
                CreateImplementation(allowReflectionEmit),
                logService);

            return(instance);
        }
Пример #9
0
        public void CreateInstance_InnerContainerAndLogServiceParamIsPresent()
        {
            LogServiceFactory.Instance.AddConsole();

            var instance = DependencyContainerFactory.CreateInstance <Container>(
                new Container(),
                LogServiceFactory.Instance.Create("unit test"));

            Assert.NotNull(instance);
            Assert.NotNull((instance as Container).Log);
        }
Пример #10
0
        public ServiceFactoryTests()
        {
            DependencyContainerCreation dependencyContainerCreation = DependencyContainerFactory.Create();

            _dependencyRegistrar = dependencyContainerCreation.Registrar;

            ServiceFactoryCreation serviceFactoryCreation = ServiceFactoryFactory.Create(dependencyContainerCreation.Registrar,
                                                                                         dependencyContainerCreation.Retriever);

            _serviceFactoryRegistrar = serviceFactoryCreation.Registrar;
            _serviceFactory          = serviceFactoryCreation.Factory;
        }
Пример #11
0
 private IDependencyContainer GetDependencyContainer(DependencyContainerFactory dependencyContainerFactory)
 {
     ArgumentChecker.IsNotNull(dependencyContainerFactory, "resolverFactory");
     return(dependencyContainerFactory.CreateInstance());
 }
Пример #12
0
        /// <summary>
        /// Creates the standard resolver.
        /// </summary>
        /// <returns>IDependencyResolver.</returns>
        public static DependencyResolver CreateStandardResolver()
        {
            IDependencyContainer container = new DependencyContainerFactory().CurrentContainer;

            return(new DependencyResolver(container));
        }
Пример #13
0
 public virtual void ContainerStart()
 {
     DependencyResolver.Container.UnityInjection(DependencyContainerFactory.GetContainer(InjectDependencies()));
 }