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

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

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

            return(instance);
        }
Пример #6
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);
        }
Пример #7
0
 private IDependencyContainer GetDependencyContainer(DependencyContainerFactory dependencyContainerFactory)
 {
     ArgumentChecker.IsNotNull(dependencyContainerFactory, "resolverFactory");
     return(dependencyContainerFactory.CreateInstance());
 }