Beispiel #1
0
        public void ContainerDefaultsToNull()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();
            var container    = bootstrapper.BaseContainer;

            Assert.IsNull(container);
        }
Beispiel #2
0
        public void RunShouldCallConfigureContainer()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureContainerCalled);
        }
Beispiel #3
0
        public void RunShouldCallCreateShell()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.CreateShellCalled);
        }
Beispiel #4
0
        public void RunShouldCallConfigureRegionAdapterMappings()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureRegionAdapterMappingsCalled);
        }
Beispiel #5
0
        public void RunShouldAssignRegionManagerToReturnedShell()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            bootstrapper.Run();

            Assert.IsNotNull(RegionManager.GetRegionManager(bootstrapper.BaseShell));
        }
Beispiel #6
0
        public void RunShouldCallInitializeModules()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.InitializeModulesCalled);
        }
Beispiel #7
0
        public void RunShouldCallConfigureModuleCatalog()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureModuleCatalogCalled);
        }
Beispiel #8
0
        public void RunConfiguresServiceLocatorProvider()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(ServiceLocator.Current is DryIocServiceLocatorAdapter);
        }
Beispiel #9
0
        public void RunShouldCallConfigureDefaultRegionBehaviors()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureDefaultRegionBehaviorsCalled);
        }
Beispiel #10
0
        public void RunShouldNotFailIfReturnedNullShell()
        {
            var bootstrapper = new DefaultDryIocBootstrapper {
                ShellObject = null
            };

            bootstrapper.Run();
        }
Beispiel #11
0
        public void RegisterFrameworkExceptionTypesShouldRegisterResolutionFailedException()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            bootstrapper.CallRegisterFrameworkExceptionTypes();

            Assert.IsTrue(ExceptionExtensions.IsFrameworkExceptionRegistered(
                              typeof(ContainerException)));
        }
Beispiel #12
0
        public void CreateContainerShouldInitializeContainer()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            IContainer container = bootstrapper.CallCreateContainer();

            Assert.IsNotNull(container);
            Assert.IsInstanceOfType(container, typeof(IContainer));
        }
Beispiel #13
0
        public void RunShouldLogAboutRegisteringFrameworkExceptionTypes()
        {
            const string expectedMessageText = "Registering Framework Exception Types.";
            var          bootstrapper        = new DefaultDryIocBootstrapper();

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
Beispiel #14
0
        public void RunShouldLogAboutConfiguringContainerBuilder()
        {
            const string expectedMessageText = "Configuring the DryIoc container.";
            var          bootstrapper        = new DefaultDryIocBootstrapper();

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
Beispiel #15
0
        public void RunShouldLogAboutConfiguringModuleCatalog()
        {
            const string expectedMessageText = "Configuring module catalog.";
            var          bootstrapper        = new DefaultDryIocBootstrapper();

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
Beispiel #16
0
        public void RunShouldLogLoggerCreationSuccess()
        {
            const string expectedMessageText = "Logger was created successfully.";
            var          bootstrapper        = new DefaultDryIocBootstrapper();

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
Beispiel #17
0
        public void RunShouldLogAboutCreatingTheShell()
        {
            const string expectedMessageText = "Creating the shell.";
            var          bootstrapper        = new DefaultDryIocBootstrapper();

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
Beispiel #18
0
        public void ConfigureContainerAddsLoggerFacadeToContainer()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            bootstrapper.Run();

            var returnedCatalog = bootstrapper.BaseContainer.Resolve <ILoggerFacade>();

            Assert.IsNotNull(returnedCatalog);
        }
Beispiel #19
0
        public void RunShouldLogAboutConfiguringRegionBehaviors()
        {
            const string expectedMessageText = "Configuring default region behaviors.";
            var          bootstrapper        = new DefaultDryIocBootstrapper();

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
Beispiel #20
0
        public void RunAddsCompositionContainerToContainer()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            var createdContainer  = bootstrapper.CallCreateContainer();
            var returnedContainer = createdContainer.Resolve <IContainer>();

            Assert.IsNotNull(returnedContainer);
            Assert.IsTrue(returnedContainer.GetType().GetInterfaces().Contains(typeof(IContainer)));
        }
Beispiel #21
0
        public void RunShouldLogAboutRunCompleting()
        {
            const string expectedMessageText = "Bootstrapper sequence completed.";
            var          bootstrapper        = new DefaultDryIocBootstrapper();

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
Beispiel #22
0
        public void RunShouldLogAboutInitializingModules()
        {
            const string expectedMessageText = "Initializing modules.";
            var          bootstrapper        = new DefaultDryIocBootstrapper();

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
Beispiel #23
0
        public void ConfigureContainerAddsModuleCatalogToContainer()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            bootstrapper.Run();

            var returnedCatalog = bootstrapper.BaseContainer.Resolve <IModuleCatalog>();

            Assert.IsNotNull(returnedCatalog);
            Assert.IsTrue(returnedCatalog is ModuleCatalog);
        }
Beispiel #24
0
        public void RunRegistersTypeForRegionAdapterMappings()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            bootstrapper.Run();

            var regionAdapterMappings = bootstrapper.BaseContainer.Resolve <RegionAdapterMappings>();

            Assert.IsNotNull(regionAdapterMappings);
            Assert.AreEqual(typeof(RegionAdapterMappings), regionAdapterMappings.GetType());
        }
Beispiel #25
0
        public void RunRegistersInstanceOfILoggerFacade()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            bootstrapper.Run();

            var logger = bootstrapper.BaseContainer.Resolve <ILoggerFacade>();

            Assert.IsNotNull(logger);
            Assert.IsTrue(logger.GetType().IsClass);
            Assert.IsTrue(logger.GetType().GetInterfaces().Contains(typeof(ILoggerFacade)));
        }
Beispiel #26
0
        public void RunRegistersInstanceOfIModuleCatalog()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            bootstrapper.Run();

            var moduleCatalog = bootstrapper.BaseContainer.Resolve <IModuleCatalog>();

            Assert.IsNotNull(moduleCatalog);
            Assert.IsTrue(moduleCatalog.GetType().IsClass);
            Assert.IsTrue(moduleCatalog.GetType().GetInterfaces().Contains(typeof(IModuleCatalog)));
        }
Beispiel #27
0
        public void RunRegistersTypeForIModuleInitializer()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            bootstrapper.Run();

            var moduleInitializer = bootstrapper.BaseContainer.Resolve <IModuleInitializer>();

            Assert.IsNotNull(moduleInitializer);
            Assert.IsTrue(moduleInitializer.GetType().IsClass);
            Assert.IsTrue(moduleInitializer.GetType().GetInterfaces().Contains(typeof(IModuleInitializer)));
        }
Beispiel #28
0
        public void RunRegistersTypeForIRegionBehaviorFactory()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            bootstrapper.Run();

            var regionBehaviorFactory = bootstrapper.BaseContainer.Resolve <IRegionBehaviorFactory>();

            Assert.IsNotNull(regionBehaviorFactory);
            Assert.IsTrue(regionBehaviorFactory.GetType().IsClass);
            Assert.IsTrue(regionBehaviorFactory.GetType().GetInterfaces().Contains(typeof(IRegionBehaviorFactory)));
        }
Beispiel #29
0
        public void RunRegistersTypeForIEventAggregator()
        {
            var bootstrapper = new DefaultDryIocBootstrapper();

            bootstrapper.Run();

            var eventAggregator = bootstrapper.BaseContainer.Resolve <IEventAggregator>();

            Assert.IsNotNull(eventAggregator);
            Assert.IsTrue(eventAggregator.GetType().IsClass);
            Assert.IsTrue(eventAggregator.GetType().GetInterfaces().Contains(typeof(IEventAggregator)));
        }
Beispiel #30
0
        public void RunShouldNotLogAboutInitializingTheShellIfShellIsNotCreated()
        {
            const string expectedMessageText = "Initializing shell";
            var          bootstrapper        = new DefaultDryIocBootstrapper {
                ShellObject = null
            };

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsFalse(messages.Contains(expectedMessageText));
        }