Ejemplo n.º 1
0
            public override void Configure(Container container)
            {
                JsConfig.DateHandler = JsonDateHandler.ISO8601;

                InitializeAutoMapper.InitializarAutomap();

                SetConfig(new EndpointHostConfig
                {
                    GlobalResponseHeaders =
                    {
                        { "Access-Control-Allow-Origin",  "*"                               },
                        { "Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS" },
                    },
                });
                SetConfig(new EndpointHostConfig
                {
                    //EnableFeatures = Feature.All.Remove(Feature.All).Add(Feature.Xml | Feature.Json | Feature.Html).Add(Feature.Metadata),
                });

                //register any dependencies your services use, e.g:
                IUnityContainer unityContainer = new UnityContainer();

                //App Services
                unityContainer.RegisterType <IClientesAppServices, ClientesAppServices>();
                unityContainer.RegisterType <ICategoriasAppServices, CategoriasAppServices>();

                var unityAdapter = new UnityContainerAdapter(unityContainer);

                container.Adapter = unityAdapter;
            }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates an empty IoC container
        /// </summary>
        /// <returns></returns>
        public static IContainer CreateIoCContainer()
        {
            var container = new UnityContainerAdapter();
            ServiceLocator.IoC = container;

            return container;
        }
        public void BuildConfiguration()
        {
            Guard.Against <ArgumentNullException>(Container == null, "Ошибка построения конфигурации: не определен Unity - контейнер");
            Guard.Against <ArgumentNullException>(NCommonConfigActions != null && NCommonConfigGets != null, "Ошибка построения конфигурации: определено две взаимоисключающие конфигурации NCommon");

            try
            {
                if (NCommonConfigActions != null)
                {
                    var adapter = new UnityContainerAdapter(Container);
                    NCommonConfigActions(Configure.Using(adapter));
                }
                else if (NCommonConfigGets != null)
                {
                    NCommonConfigGets(Container);
                }

                if (!BusinessOperationConfigs.IsNullOrEmpty())
                {
                    BusinessOperationConfigs.ForEach(config => config.Value.Confugure(Container));
                }

                if (ProcessConfig != null)
                {
                    ProcessConfig.Confugure(Container);
                }

                //Validate
                var validStr = Container.GetMappingAsString();
            }
            catch (Exception e)
            {
                throw;
            }
        }
Ejemplo n.º 4
0
        public override void Configure(Container container)
        {
            var unityContainer = new UnityContainer()
              .AddNewExtension<BuildTracking>()
              .AddNewExtension<LogCreation>();

            var userRepository = new InMemoryAuthRepository();

            this.Plugins.Add(new AuthFeature(() => new AuthUserSession(),
              new IAuthProvider[] { new BasicAuthProvider()}));

            this.Plugins.Add(new RegistrationFeature());

            unityContainer.RegisterInstance<ICacheClient>(new MemoryCacheClient());
            unityContainer.RegisterInstance<IUserAuthRepository>(userRepository);

            unityContainer.RegisterInstance<IDbConnectionFactory>(new OrmLiteConnectionFactory("~/Database/SmartDom.db".MapServerPath(),
                SqliteOrmLiteDialectProvider.Instance));

            unityContainer.RegisterType<IOrmWrapper, OrmWrapper>();
            unityContainer.RegisterType<IConfigurationRepository, AppConfigRepository>();
            unityContainer.RegisterType<MediaAdapterAbstractFactory<SerialPort>, SerialPortAdapterFactory>(new ContainerControlledLifetimeManager());
            unityContainer.RegisterType<ModbusMasterAbstractFactory<SerialPort>, RtuSerialModbusMasterFactory>(new ContainerControlledLifetimeManager());
            unityContainer.RegisterType<IGenericRepository<Device>, DeviceDbRepository>(new ContainerControlledLifetimeManager(),
                new InjectionMethod("Initialize"));
            unityContainer.RegisterType<IDeviceAccessLayer, SerialAccessLayer>(new ContainerControlledLifetimeManager());
            unityContainer.RegisterType<IMessageDecoder, MessageDecoder>();
            unityContainer.RegisterType<IDeviceManager, DeviceManager>();

            var unityAdapter = new UnityContainerAdapter(unityContainer);
            container.Adapter = unityAdapter;

            AddUser(userRepository);
        }
Ejemplo n.º 5
0
        public void TryResolveShouldReturnNullIfElementNotExist()
        {
            IUnityContainer  container        = new UnityContainer();
            IContainerFacade containerAdapter = new UnityContainerAdapter(container);

            object dependantA = containerAdapter.TryResolve(typeof(IDependantA));

            Assert.IsNull(dependantA);
        }
Ejemplo n.º 6
0
        public void CanRegisterAndResolveUsingContainerAdapter()
        {
            IUnityContainer container = new UnityContainer();
            IContainerFacade containerAdapter = new UnityContainerAdapter(container);

            container.RegisterType<IService, MockService>();
            IService mockService = containerAdapter.Resolve(typeof(IService)) as IService;

            Assert.IsInstanceOfType(mockService, typeof(IService));
        }
Ejemplo n.º 7
0
        public void CanRegisterAndResolveUsingContainerAdapter()
        {
            IUnityContainer  container        = new UnityContainer();
            IContainerFacade containerAdapter = new UnityContainerAdapter(container);

            container.RegisterType <IService, MockService>();
            IService mockService = containerAdapter.Resolve(typeof(IService)) as IService;

            Assert.IsInstanceOfType(mockService, typeof(IService));
        }
Ejemplo n.º 8
0
        public void TryResolveShouldResolveTheElementIfElementExist()
        {
            IUnityContainer container = new UnityContainer();
            IContainerFacade containerAdapter = new UnityContainerAdapter(container);

            container.RegisterType<IService, MockService>(new ContainerControlledLifetimeManager());

            object dependantA = containerAdapter.TryResolve(typeof(IService));
            Assert.IsNotNull(dependantA);
        }
        void RegisterTransientExplicitTypesWithDependencyCreator_ReturnsSameObjectsForTwoResolutions()
        {
            var container = new UnityContainerAdapter();

            container.RegisterSingleton(typeof(ITestDependency), typeof(TestDependencyA), () => new TestDependencyA());

            var firstResolution  = container.Resolve <ITestDependency>();
            var secondResolution = container.Resolve <ITestDependency>();

            firstResolution.Should().BeSameAs(secondResolution);
        }
        void RegisterTransientDifferentContractAndImplementationWithDependencyCreator_ReturnsTwoDifferentObjectsForTwoResolutions()
        {
            var container = new UnityContainerAdapter();

            container.RegisterTransient <ITestDependency, TestDependencyA>(() => new TestDependencyA());

            var firstResolution  = container.Resolve <ITestDependency>();
            var secondResolution = container.Resolve <ITestDependency>();

            firstResolution.Should().NotBeSameAs(secondResolution);
        }
Ejemplo n.º 11
0
        public void TryResolveShouldResolveTheElementIfElementExist()
        {
            IUnityContainer  container        = new UnityContainer();
            IContainerFacade containerAdapter = new UnityContainerAdapter(container);

            container.RegisterType <IService, MockService>(new ContainerControlledLifetimeManager());

            object dependantA = containerAdapter.TryResolve(typeof(IService));

            Assert.IsNotNull(dependantA);
        }
        void RegisterSingletonSameType_ReturnsSameObjectsForTwoResolutions()
        {
            var container = new UnityContainerAdapter();

            container.RegisterSingleton <TestDependencyA>();

            var firstResolution  = container.Resolve <TestDependencyA>();
            var secondResolution = container.Resolve <TestDependencyA>();

            firstResolution.Should().BeSameAs(secondResolution);
        }
        void RegisterSingletonWithDependencyCreator_ReturnsSameObjectsForTwoResolutions()
        {
            var container = new UnityContainerAdapter();

            container.RegisterSingleton <ITestDependency>(() => new TestDependencyA());

            var firstResolution  = container.Resolve <ITestDependency>();
            var secondResolution = container.Resolve <ITestDependency>();

            firstResolution.Should().BeSameAs(secondResolution);
        }
Ejemplo n.º 14
0
        public static void Run(string[] args)
        {
            using (IContainer container = new UnityContainerAdapter())
            {
                container.RegisterType <IWindowsServiceController, WindowsServiceController>(LifetimeScope.Singleton);

                using (var windowsServiceController = container.Resolve <IWindowsServiceController>())
                {
                    windowsServiceController.RunModule(args);
                }
            }
        }
Ejemplo n.º 15
0
        public void CanRegisterAndResolveSingletonUsingContainerAdapter()
        {
            IUnityContainer container = new UnityContainer();
            IContainerFacade containerAdapter = new UnityContainerAdapter(container);


            container.RegisterType<IService, MockService>(new ContainerControlledLifetimeManager());
            IService mockService1 = containerAdapter.Resolve(typeof(IService)) as IService;
            IService mockService2 = containerAdapter.Resolve(typeof(IService)) as IService;

            Assert.IsNotNull(mockService1);
            Assert.AreSame(mockService1, mockService2);
        }
Ejemplo n.º 16
0
        public void CanRegisterAndResolveSingletonUsingContainerAdapter()
        {
            IUnityContainer  container        = new UnityContainer();
            IContainerFacade containerAdapter = new UnityContainerAdapter(container);


            container.RegisterType <IService, MockService>(new ContainerControlledLifetimeManager());
            IService mockService1 = containerAdapter.Resolve(typeof(IService)) as IService;
            IService mockService2 = containerAdapter.Resolve(typeof(IService)) as IService;

            Assert.IsNotNull(mockService1);
            Assert.AreSame(mockService1, mockService2);
        }
        public void ExportProviderResolvesServiceRegisteredByTypeTest()
        {
            // Setup
            var unityContainer = new UnityContainer();
            var adapter = new UnityContainerAdapter(unityContainer);
            var provider = new ContainerExportProvider(adapter);

            // Registration
            unityContainer.RegisterType<IUnityOnlyComponent, UnityOnlyComponent1>();

            var component = provider.GetExportedValue<IUnityOnlyComponent>();
            Assert.That(component, Is.Not.Null);
            Assert.That(component.GetType(), Is.EqualTo(typeof(UnityOnlyComponent1)));
        }
        public void MultipleImplementationAreRegisteredByTypeAsParameter_ResolvedCollectionContainsAllImplementations()
        {
            var adapter = new UnityContainerAdapter();

            adapter.RegisterCollection(typeof(ITestDependency), new[] { typeof(TestDependencyA), typeof(TestDependencyB) });

            var collection = adapter.Resolve <IEnumerable <ITestDependency> >().ToArray();

            var firstItem  = collection.First();
            var secondItem = collection.Last();

            firstItem.Should().BeOfType <TestDependencyA>();
            secondItem.Should().BeOfType <TestDependencyB>();
        }
Ejemplo n.º 19
0
        public void ContainerBuilder_WithContainer_ContainerResolvesSameInstanceForRequestDispatcher()
        {
            // Arrange
            var container = new UnityContainer();
            var adapter   = new UnityContainerAdapter(container);

            // Act
            var containerBuilder = new ContainerBuilder(name, adapter);
            var dispatcher       = container.Resolve <IRequestDispatcher>();
            var dispatcher2      = container.Resolve <IDIRequestDispatcher>();

            // Assert
            Assert.That(dispatcher, Is.SameAs(dispatcher2));
        }
        public void ExportProviderResolvesServiceRegisteredByTypeAndRegistrationNameTest()
        {
            // Setup
            var unityContainer = new UnityContainer();
            var adapter        = new UnityContainerAdapter(unityContainer);
            var provider       = new ContainerExportProvider(adapter);

            // Registration
            unityContainer.RegisterType <IUnityOnlyComponent, UnityOnlyComponent2>("unityComponent2");

            var component = provider.GetExportedValue <IUnityOnlyComponent>("unityComponent2");

            Assert.That(component, Is.Not.Null);
            Assert.That(component.GetType(), Is.EqualTo(typeof(UnityOnlyComponent2)));
        }
Ejemplo n.º 21
0
        public void IsRegistered_WithType_CallsUnityContainer()
        {
            // Arrange
            var adapter = new UnityContainerAdapter(unityContainer);

            // Act
            adapter.IsRegistered <Service>();

            // Assert
            mockUnityContainer
            .Verify(
                m => m.IsRegistered(
                    It.IsIn(typeof(Service)),
                    It.IsAny <string>()),
                Times.Once);
        }
        public void MultipleImplementationAreRegisteredByInstance_ResolvedCollectionContainsAllImplementations()
        {
            var adapter   = new UnityContainerAdapter();
            var instanceA = new TestDependencyA();
            var instanceB = new TestDependencyB();

            adapter.RegisterCollection(new ITestDependency[] { instanceA, instanceB });

            var collection = adapter.Resolve <IEnumerable <ITestDependency> >().ToArray();

            var firstItem  = collection.First();
            var secondItem = collection.Last();

            firstItem.Should().BeSameAs(instanceA);
            secondItem.Should().BeSameAs(instanceB);
        }
Ejemplo n.º 23
0
        public void Resolve_WithType_CallsUnityContainer()
        {
            // Arrange
            var adapter = new UnityContainerAdapter(unityContainer);

            // Act
            var service = adapter.Resolve <Service>();

            // Assert
            mockUnityContainer
            .Verify(
                m => m.Resolve(
                    It.IsIn(typeof(Service)),
                    It.IsAny <string>(),
                    It.IsAny <ResolverOverride[]>()),
                Times.Once);
        }
        public void ExportProviderResolvesServicesRegisteredByTypeTest()
        {
            // Setup
            var unityContainer = new UnityContainer();
            var adapter = new UnityContainerAdapter(unityContainer);
            var provider = new ContainerExportProvider(adapter);

            // Registration
            unityContainer.RegisterType<IUnityOnlyComponent, UnityOnlyComponent1>();
            unityContainer.RegisterType<IUnityOnlyComponent, UnityOnlyComponent2>("b");

            var components = provider.GetExports<IUnityOnlyComponent>();
            Assert.That(components, Is.Not.Null);
            Assert.That(components.Count(), Is.EqualTo(2));

            Assert.That(components.Select(t => t.Value).OfType<UnityOnlyComponent1>().Count(), Is.EqualTo(1));
            Assert.That(components.Select(t => t.Value).OfType<UnityOnlyComponent2>().Count(), Is.EqualTo(1));
        }
Ejemplo n.º 25
0
        public void Register_WithType_WithSingleton_CallsUnityContainer()
        {
            // Arrange
            var adapter = new UnityContainerAdapter(unityContainer);

            // Act
            adapter.Register <Service>(true);

            // Assert
            mockUnityContainer
            .Verify(
                m => m.RegisterType(
                    It.IsAny <Type>(),
                    It.IsAny <Type>(),
                    It.IsAny <string>(),
                    It.IsAny <ITypeLifetimeManager>()),
                Times.Once);
        }
Ejemplo n.º 26
0
        public void CanResolveCascadingDependencies()
        {
            IUnityContainer container = new UnityContainer();
            IContainerFacade containerAdapter = new UnityContainerAdapter(container);

            container.RegisterType<IDependantA, DependantA>();
            container.RegisterType<IDependantB, DependantB>();
            container.RegisterType<IService, MockService>(new ContainerControlledLifetimeManager());

            IDependantA dependantA = containerAdapter.Resolve(typeof(IDependantA)) as IDependantA;
            Assert.IsNotNull(dependantA);
            Assert.IsInstanceOfType(dependantA, typeof(IDependantA));
            Assert.IsNotNull(dependantA.MyDependantB);
            Assert.IsInstanceOfType(dependantA.MyDependantB, typeof(IDependantB));
            Assert.IsNotNull(dependantA.MyDependantB.MyService);
            Assert.IsInstanceOfType(dependantA.MyDependantB.MyService, typeof(IService));

        }
Ejemplo n.º 27
0
        public void CanResolveCascadingDependencies()
        {
            IUnityContainer  container        = new UnityContainer();
            IContainerFacade containerAdapter = new UnityContainerAdapter(container);

            container.RegisterType <IDependantA, DependantA>();
            container.RegisterType <IDependantB, DependantB>();
            container.RegisterType <IService, MockService>(new ContainerControlledLifetimeManager());

            IDependantA dependantA = containerAdapter.Resolve(typeof(IDependantA)) as IDependantA;

            Assert.IsNotNull(dependantA);
            Assert.IsInstanceOfType(dependantA, typeof(IDependantA));
            Assert.IsNotNull(dependantA.MyDependantB);
            Assert.IsInstanceOfType(dependantA.MyDependantB, typeof(IDependantB));
            Assert.IsNotNull(dependantA.MyDependantB.MyService);
            Assert.IsInstanceOfType(dependantA.MyDependantB.MyService, typeof(IService));
        }
Ejemplo n.º 28
0
        public void Register_WithInstance_CallsUnityContainer()
        {
            // Arrange
            var adapter = new UnityContainerAdapter(unityContainer);
            var service = new Service();

            // Act
            adapter.Register(service);

            // Assert
            mockUnityContainer
            .Verify(
                m => m.RegisterInstance(
                    It.IsIn(typeof(Service)),
                    It.IsAny <string>(),
                    It.IsAny <object>(),
                    It.IsAny <IInstanceLifetimeManager>()),
                Times.Once);
        }
        public void ExportProviderResolvesServicesRegisteredByTypeTest()
        {
            // Setup
            var unityContainer = new UnityContainer();
            var adapter        = new UnityContainerAdapter(unityContainer);
            var provider       = new ContainerExportProvider(adapter);

            // Registration
            unityContainer.RegisterType <IUnityOnlyComponent, UnityOnlyComponent1>();
            unityContainer.RegisterType <IUnityOnlyComponent, UnityOnlyComponent2>("b");

            var components = provider.GetExports <IUnityOnlyComponent>();

            Assert.That(components, Is.Not.Null);
            Assert.That(components.Count(), Is.EqualTo(2));

            Assert.That(components.Select(t => t.Value).OfType <UnityOnlyComponent1>().Count(), Is.EqualTo(1));
            Assert.That(components.Select(t => t.Value).OfType <UnityOnlyComponent2>().Count(), Is.EqualTo(1));
        }
        public void MefCannotResolveTypesRegisteredInUnityBeforeTrackingExtensionIsAddedTest()
        {
            // Setup
            var unityContainer = new UnityContainer();

            // Registration
            unityContainer.RegisterType <IUnityOnlyComponent, UnityOnlyComponent2>("unityComponent2");

            // Further setup
            var adapter         = new UnityContainerAdapter(unityContainer);
            var provider        = new ContainerExportProvider(adapter);
            var assemblyCatalog = new AssemblyCatalog(Assembly.GetExecutingAssembly());
            var container       = new CompositionContainer(assemblyCatalog, provider);

            Assert.That(delegate
            {
                container.GetExportedValue <IUnityOnlyComponent>("unityComponent2");
            }, Throws.TypeOf <ImportCardinalityMismatchException>());
        }
        public void MefCanResolveLazyTypeRegisteredInUnityTest()
        {
            // Setup
            var unityContainer = new UnityContainer();
            var adapter = new UnityContainerAdapter(unityContainer);
            var provider = new ContainerExportProvider(adapter);
            var assemblyCatalog = new AssemblyCatalog(Assembly.GetExecutingAssembly());
            var container = new CompositionContainer(assemblyCatalog, provider);

            UnityOnlyComponent1.InstanceCount = 0;
            unityContainer.RegisterType<IUnityOnlyComponent, UnityOnlyComponent1>();

            var lazyUnityComponent = container.GetExport<IUnityOnlyComponent>();
            Assert.That(lazyUnityComponent, Is.Not.Null);
            Assert.That(UnityOnlyComponent1.InstanceCount, Is.EqualTo(0));

            Assert.That(lazyUnityComponent.Value, Is.Not.Null);
            Assert.That(lazyUnityComponent.Value.GetType(), Is.EqualTo(typeof(UnityOnlyComponent1)));
            Assert.That(UnityOnlyComponent1.InstanceCount, Is.EqualTo(1));
        }
        public void MefCanResolveLazyTypeRegisteredInUnityTest()
        {
            // Setup
            var unityContainer  = new UnityContainer();
            var adapter         = new UnityContainerAdapter(unityContainer);
            var provider        = new ContainerExportProvider(adapter);
            var assemblyCatalog = new AssemblyCatalog(Assembly.GetExecutingAssembly());
            var container       = new CompositionContainer(assemblyCatalog, provider);

            UnityOnlyComponent1.InstanceCount = 0;
            unityContainer.RegisterType <IUnityOnlyComponent, UnityOnlyComponent1>();

            var lazyUnityComponent = container.GetExport <IUnityOnlyComponent>();

            Assert.That(lazyUnityComponent, Is.Not.Null);
            Assert.That(UnityOnlyComponent1.InstanceCount, Is.EqualTo(0));

            Assert.That(lazyUnityComponent.Value, Is.Not.Null);
            Assert.That(lazyUnityComponent.Value.GetType(), Is.EqualTo(typeof(UnityOnlyComponent1)));
            Assert.That(UnityOnlyComponent1.InstanceCount, Is.EqualTo(1));
        }
        public void MefCanResolveTypesRegisteredInUnityAfterTrackingExtensionIsAddedTest()
        {
            // Setup
            var unityContainer = new UnityContainer();

            // Enable tracking
            TypeRegistrationTrackerExtension.RegisterIfMissing(unityContainer);

            // Registration
            unityContainer.RegisterType <IUnityOnlyComponent, UnityOnlyComponent2>("unityComponent2");

            // Further setup
            var adapter         = new UnityContainerAdapter(unityContainer);
            var provider        = new ContainerExportProvider(adapter);
            var assemblyCatalog = new AssemblyCatalog(Assembly.GetExecutingAssembly());
            var container       = new CompositionContainer(assemblyCatalog, provider);

            var component = container.GetExportedValue <IUnityOnlyComponent>("unityComponent2");

            Assert.That(component, Is.Not.Null);
            Assert.That(component.GetType(), Is.EqualTo(typeof(UnityOnlyComponent2)));
        }
        //, IEnumerable<Type> serviceExclusions = null)
        public static void RegistrationByConvention(this UnityContainer container, BehaviorConfiguration configuration, Action<IConventionBuilder<LifetimeManager>, IImplementationFilter> convention)
        {
            if (configuration == null)
            {
                configuration = BehaviorConfiguration.Default;
            }

            var logger = new DiagnosticLogger(configuration);
            var serviceMappingTracker = new ServiceMappingTracker(logger);
            var implementationFilter = new ImplementationFilter();
            var configServiceFilter = ((IBehaviorConfiguration)configuration).GetServiceFilter();

            var adapter = new UnityContainerAdapter(container, serviceMappingTracker);
            var asmSelector = new AssemblySelector();
            var serviceExtractor = new ServiceExtractor();
            var serviceFilterAggregator = new ServiceFilterAggregator(new IServiceFilter[] { configServiceFilter, implementationFilter, serviceExtractor, serviceMappingTracker });

            using (var builder = new ConventionBuilder<LifetimeManager>(adapter, asmSelector, serviceFilterAggregator, serviceExtractor))
            {
                convention(builder, implementationFilter);
            }
        }
        public void MefCannotResolveTypesRegisteredInUnityBeforeTrackingExtensionIsAddedTest()
        {
            // Setup
            var unityContainer = new UnityContainer();

            // Registration
            unityContainer.RegisterType<IUnityOnlyComponent, UnityOnlyComponent2>("unityComponent2");

            // Further setup
            var adapter = new UnityContainerAdapter(unityContainer);
            var provider = new ContainerExportProvider(adapter);
            var assemblyCatalog = new AssemblyCatalog(Assembly.GetExecutingAssembly());
            var container = new CompositionContainer(assemblyCatalog, provider);

            Assert.That(delegate
            {
                container.GetExportedValue<IUnityOnlyComponent>("unityComponent2");
            }, Throws.TypeOf<ImportCardinalityMismatchException>());
        }
        public void MefCanResolveTypesRegisteredInUnityAfterTrackingExtensionIsAddedTest()
        {
            // Setup
            var unityContainer = new UnityContainer();

            // Enable tracking
            TypeRegistrationTrackerExtension.RegisterIfMissing(unityContainer);

            // Registration
            unityContainer.RegisterType<IUnityOnlyComponent, UnityOnlyComponent2>("unityComponent2");

            // Further setup
            var adapter = new UnityContainerAdapter(unityContainer);
            var provider = new ContainerExportProvider(adapter);
            var assemblyCatalog = new AssemblyCatalog(Assembly.GetExecutingAssembly());
            var container = new CompositionContainer(assemblyCatalog, provider);

            var component = container.GetExportedValue<IUnityOnlyComponent>("unityComponent2");
            Assert.That(component, Is.Not.Null);
            Assert.That(component.GetType(), Is.EqualTo(typeof(UnityOnlyComponent2)));
        }
Ejemplo n.º 37
0
 /// <summary>
 ///     Creates instance of BootstrapperRunner
 /// </summary>
 public BootstrapperRunner()
 {
     Container = new UnityContainerAdapter();
 }
Ejemplo n.º 38
0
        public void TryResolveShouldReturnNullIfElementNotExist()
        {
            IUnityContainer container = new UnityContainer();
            IContainerFacade containerAdapter = new UnityContainerAdapter(container);

            object dependantA = containerAdapter.TryResolve(typeof(IDependantA));
            Assert.IsNull(dependantA);
        }