public void RunConfiguresServiceLocatorProvider()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();
            bootstrapper.Run();

            Assert.IsTrue(Microsoft.Practices.ServiceLocation.ServiceLocator.Current is StructureMapServiceLocatorAdapter);
        }
        public void RunShouldCallInitializeModules()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();
            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.InitializeModulesCalled);
        }
        public void ContainerDefaultsToNull()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();
            var container    = bootstrapper.BaseContainer;

            Assert.IsNull(container);
        }
        public void ContainerDefaultsToNull()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();
            var container = bootstrapper.BaseContainer;

            Assert.IsNull(container);
        }
Esempio n. 5
0
        public void RunConfiguresServiceLocatorProvider()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(Microsoft.Practices.ServiceLocation.ServiceLocator.Current is StructureMapServiceLocatorAdapter);
        }
        public void RunShouldCallConfigureModuleCatalog()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            Assert.True(bootstrapper.ConfigureModuleCatalogCalled);
        }
        public void RunShouldCallConfigureDefaultRegionBehaviors()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureDefaultRegionBehaviorsCalled);
        }
        public void RunShouldCallInitializeModules()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.InitializeModulesCalled);
        }
        public void RunShouldNotFailIfReturnedNullShell()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper {
                ShellObject = null
            };

            bootstrapper.Run();
        }
        public void RunShouldCallConfigureRegionAdapterMappings()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureRegionAdapterMappingsCalled);
        }
        public void RunShouldCallCreateShell()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.CreateShellCalled);
        }
        public void RunShouldCallConfigureContainer()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureContainerCalled);
        }
        public void RunShouldAssignRegionManagerToReturnedShell()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            Assert.IsNotNull(RegionManager.GetRegionManager(bootstrapper.BaseShell));
        }
        public void RunShouldCallConfigureDefaultRegionBehaviors()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureDefaultRegionBehaviorsCalled);
        }
        public void RunShouldCallConfigureRegionAdapterMappings()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureRegionAdapterMappingsCalled);
        }
        public void RunConfiguresServiceLocatorProvider()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(CommonServiceLocator.ServiceLocator.Current is StructureMapServiceLocatorAdapter);
        }
        public void ConfigureContainerAddsLoggerFacadeToContainer()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();
            bootstrapper.Run();

            var returnedCatalog = bootstrapper.BaseContainer.GetInstance<ILoggerFacade>();
            Assert.IsNotNull(returnedCatalog);
        }
        public void RegisterFrameworkExceptionTypesShouldRegisterActivationException()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.CallRegisterFrameworkExceptionTypes();

            Assert.IsTrue(ExceptionExtensions.IsFrameworkExceptionRegistered(
                              typeof(Microsoft.Practices.ServiceLocation.ActivationException)));
        }
        public void CreateContainerShouldInitializeContainer()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            IContainer container = bootstrapper.CallCreateContainer();

            Assert.IsNotNull(container);
            Assert.IsInstanceOfType(container, typeof(IContainer));
        }
        public void CreateContainerShouldInitializeContainer()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            IContainer container = bootstrapper.CallCreateContainer();

            Assert.IsNotNull(container);
            Assert.IsInstanceOfType(container, typeof(IContainer));
        }
        public void RunAddsCompositionContainerToContainer()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            var createdContainer = bootstrapper.CallCreateContainer();
            var returnedContainer = createdContainer.GetInstance<IContainer>();
            Assert.IsNotNull(returnedContainer);
            Assert.AreEqual(typeof(Container), returnedContainer.GetType());
        }
Esempio n. 22
0
        public void CreateContainerShouldInitializeContainer()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            IContainer container = bootstrapper.CallCreateContainer();

            Assert.NotNull(container);
            Assert.IsAssignableFrom <IContainer>(container);
        }
Esempio n. 23
0
        public void RegisterFrameworkExceptionTypesShouldRegisterActivationException()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.CallRegisterFrameworkExceptionTypes();

            Assert.True(ExceptionExtensions.IsFrameworkExceptionRegistered(
                            typeof(ActivationException)));
        }
        public void ConfigureContainerAddsModuleCatalogToContainer()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();
            bootstrapper.Run();

            var returnedCatalog = bootstrapper.BaseContainer.GetInstance<IModuleCatalog>();
            Assert.IsNotNull(returnedCatalog);
            Assert.IsTrue(returnedCatalog is ModuleCatalog);
        }
        public void RunShouldLogAboutConfiguringContainer()
        {
            const string expectedMessageText = "Configuring the StructureMap container.";
            var          bootstrapper        = new DefaultStructureMapBootstrapper();

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

            Assert.True(messages.Contains(expectedMessageText));
        }
        public void RunAddsCompositionContainerToContainer()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

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

            Assert.IsNotNull(returnedContainer);
            Assert.AreEqual(typeof(Container), returnedContainer.GetType());
        }
        public void RunShouldLogAboutRunCompleting()
        {
            const string expectedMessageText = "Bootstrapper sequence completed.";
            var          bootstrapper        = new DefaultStructureMapBootstrapper();

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

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
        public void RunShouldLogAboutInitializingModules()
        {
            const string expectedMessageText = "Initializing modules.";
            var          bootstrapper        = new DefaultStructureMapBootstrapper();

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

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

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

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
        public void RunShouldLogAboutRegisteringFrameworkExceptionTypes()
        {
            const string expectedMessageText = "Registering Framework Exception Types.";
            var          bootstrapper        = new DefaultStructureMapBootstrapper();

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

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
        public void RunShouldLogAboutConfiguringRegionBehaviors()
        {
            const string expectedMessageText = "Configuring default region behaviors.";
            var          bootstrapper        = new DefaultStructureMapBootstrapper();

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

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
        public void ConfigureContainerAddsLoggerFacadeToContainer()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

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

            Assert.IsNotNull(returnedCatalog);
        }
        public void RunShouldLogLoggerCreationSuccess()
        {
            const string expectedMessageText = "Logger was created successfully.";
            var          bootstrapper        = new DefaultStructureMapBootstrapper();

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

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
        public void RunShouldLogAboutModuleCatalogCreation()
        {
            const string expectedMessageText = "Creating module catalog.";
            var          bootstrapper        = new DefaultStructureMapBootstrapper();

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

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
        public void ConfigureContainerAddsModuleCatalogToContainer()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

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

            Assert.IsNotNull(returnedCatalog);
            Assert.IsTrue(returnedCatalog is ModuleCatalog);
        }
        public void RunRegistersTypeForRegionAdapterMappings()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

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

            Assert.IsNotNull(regionAdapterMappings);
            Assert.AreEqual(typeof(RegionAdapterMappings), regionAdapterMappings.GetType());
        }
        public void RunRegistersTypeForIEventAggregator()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

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

            Assert.IsNotNull(eventAggregator);
            Assert.IsTrue(eventAggregator.GetType().IsClass);
            Assert.IsTrue(eventAggregator.GetType().GetInterfaces().Contains(typeof(IEventAggregator)));
        }
        public void ConfigureContainerAddsRegionNavigationJournalToContainer()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();
            bootstrapper.Run();

            var actual1 = bootstrapper.BaseContainer.GetInstance<IRegionNavigationJournal>();
            var actual2 = bootstrapper.BaseContainer.GetInstance<IRegionNavigationJournal>();

            Assert.IsNotNull(actual1);
            Assert.IsNotNull(actual2);
            Assert.AreNotSame(actual1, actual2);
        }
        public void RunRegistersTypeForIRegionBehaviorFactory()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

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

            Assert.IsNotNull(regionBehaviorFactory);
            Assert.IsTrue(regionBehaviorFactory.GetType().IsClass);
            Assert.IsTrue(regionBehaviorFactory.GetType().GetInterfaces().Contains(typeof(IRegionBehaviorFactory)));
        }
        public void RunShouldNotLogAboutInitializingTheShellIfShellIsNotCreated()
        {
            const string expectedMessageText = "Initializing shell";
            var          bootstrapper        = new DefaultStructureMapBootstrapper {
                ShellObject = null
            };

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

            Assert.IsFalse(messages.Contains(expectedMessageText));
        }
        public void RunShouldInitializeContainer()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();
            var container = bootstrapper.BaseContainer;

            Assert.IsNull(container);

            bootstrapper.Run();

            container = bootstrapper.BaseContainer;

            Assert.IsNotNull(container);
            Assert.IsInstanceOfType(container, typeof(Container));
        }
        public void RunShouldLogAboutInitializingModules()
        {
            const string expectedMessageText = "Initializing modules.";
            var bootstrapper = new DefaultStructureMapBootstrapper();
            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
        public void RunShouldNotLogAboutInitializingTheShellIfShellIsNotCreated()
        {
            const string expectedMessageText = "Initializing shell";
            var bootstrapper = new DefaultStructureMapBootstrapper { ShellObject = null };

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

            Assert.IsFalse(messages.Contains(expectedMessageText));
        }
        public void RunShouldLogAboutCreatingTheShell()
        {
            const string expectedMessageText = "Creating the shell.";
            var bootstrapper = new DefaultStructureMapBootstrapper();
            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
        public void RunShouldLogAboutRegisteringFrameworkExceptionTypes()
        {
            const string expectedMessageText = "Registering Framework Exception Types.";
            var bootstrapper = new DefaultStructureMapBootstrapper();
            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
        public void RunShouldLogAboutConfiguringRegionBehaviors()
        {
            const string expectedMessageText = "Configuring default region behaviors.";
            var bootstrapper = new DefaultStructureMapBootstrapper();
            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
        public void RunShouldLogAboutModuleCatalogCreation()
        {
            const string expectedMessageText = "Creating module catalog.";
            var bootstrapper = new DefaultStructureMapBootstrapper();
            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
        public void RunRegistersInstanceOfILoggerFacade()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            var logger = bootstrapper.BaseContainer.GetInstance<ILoggerFacade>();
            Assert.IsNotNull(logger);
            Assert.IsTrue(logger.GetType().IsClass);
            Assert.IsTrue(logger.GetType().GetInterfaces().Contains(typeof(ILoggerFacade)));
        }
        public void RunShouldLogAboutRunCompleting()
        {
            const string expectedMessageText = "Bootstrapper sequence completed.";
            var bootstrapper = new DefaultStructureMapBootstrapper();
            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
        public void RunShouldCallTheMethodsInOrder()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();
            bootstrapper.Run();

            Assert.AreEqual("CreateLogger", bootstrapper.MethodCalls[0]);
            Assert.AreEqual("CreateModuleCatalog", bootstrapper.MethodCalls[1]);
            Assert.AreEqual("ConfigureModuleCatalog", bootstrapper.MethodCalls[2]);
            Assert.AreEqual("CreateContainer", bootstrapper.MethodCalls[3]);
            Assert.AreEqual("ConfigureContainer", bootstrapper.MethodCalls[4]);
            Assert.AreEqual("ConfigureServiceLocator", bootstrapper.MethodCalls[5]);
            Assert.AreEqual("ConfigureRegionAdapterMappings", bootstrapper.MethodCalls[6]);
            Assert.AreEqual("ConfigureDefaultRegionBehaviors", bootstrapper.MethodCalls[7]);
            Assert.AreEqual("RegisterFrameworkExceptionTypes", bootstrapper.MethodCalls[8]);
            Assert.AreEqual("CreateShell", bootstrapper.MethodCalls[9]);
            Assert.AreEqual("InitializeShell", bootstrapper.MethodCalls[10]);
            Assert.AreEqual("InitializeModules", bootstrapper.MethodCalls[11]);
        }
        public void RunRegistersTypeForIEventAggregator()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            var eventAggregator = bootstrapper.BaseContainer.GetInstance<IEventAggregator>();
            Assert.IsNotNull(eventAggregator);
            Assert.IsTrue(eventAggregator.GetType().IsClass);
            Assert.IsTrue(eventAggregator.GetType().GetInterfaces().Contains(typeof(IEventAggregator)));
        }
        public void RunRegistersTypeForIRegionBehaviorFactory()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            var regionBehaviorFactory = bootstrapper.BaseContainer.GetInstance<IRegionBehaviorFactory>();
            Assert.IsNotNull(regionBehaviorFactory);
            Assert.IsTrue(regionBehaviorFactory.GetType().IsClass);
            Assert.IsTrue(regionBehaviorFactory.GetType().GetInterfaces().Contains(typeof(IRegionBehaviorFactory)));
        }
        public void RunRegistersTypeForRegionAdapterMappings()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            var regionAdapterMappings = bootstrapper.BaseContainer.GetInstance<RegionAdapterMappings>();
            Assert.IsNotNull(regionAdapterMappings);
            Assert.AreEqual(typeof(RegionAdapterMappings), regionAdapterMappings.GetType());
        }
        public void RunShouldCallConfigureContainer()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureContainerCalled);
        }
        public void RunShouldLogLoggerCreationSuccess()
        {
            const string expectedMessageText = "Logger was created successfully.";
            var bootstrapper = new DefaultStructureMapBootstrapper();
            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
        public void RunRegistersInstanceOfIModuleCatalog()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            var moduleCatalog = bootstrapper.BaseContainer.GetInstance<IModuleCatalog>();
            Assert.IsNotNull(moduleCatalog);
            Assert.IsTrue(moduleCatalog.GetType().IsClass);
            Assert.IsTrue(moduleCatalog.GetType().GetInterfaces().Contains(typeof(IModuleCatalog)));
        }
        public void RunRegistersTypeForIModuleInitializer()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            var moduleInitializer = bootstrapper.BaseContainer.GetInstance<IModuleInitializer>();
            Assert.IsNotNull(moduleInitializer);
            Assert.IsTrue(moduleInitializer.GetType().IsClass);
            Assert.IsTrue(moduleInitializer.GetType().GetInterfaces().Contains(typeof(IModuleInitializer)));
        }
        public void RunShouldLogBootstrapperSteps()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();
            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages[0].Contains("Logger was created successfully."));
            Assert.IsTrue(messages[1].Contains("Creating module catalog."));
            Assert.IsTrue(messages[2].Contains("Configuring module catalog."));
            Assert.IsTrue(messages[3].Contains("Creating StructureMap container."));
            Assert.IsTrue(messages[4].Contains("Configuring the StructureMap container."));
            Assert.IsTrue(messages[5].Contains("Configuring ServiceLocator singleton."));
            Assert.IsTrue(messages[6].Contains("Configuring the ViewModelLocator to use StructureMap."));
            Assert.IsTrue(messages[7].Contains("Configuring region adapters."));
            Assert.IsTrue(messages[8].Contains("Configuring default region behaviors."));
            Assert.IsTrue(messages[9].Contains("Registering Framework Exception Types."));
            Assert.IsTrue(messages[10].Contains("Creating the shell."));
            Assert.IsTrue(messages[11].Contains("Setting the RegionManager."));
            Assert.IsTrue(messages[12].Contains("Updating Regions."));
            Assert.IsTrue(messages[13].Contains("Initializing the shell."));
            Assert.IsTrue(messages[14].Contains("Initializing modules."));
            Assert.IsTrue(messages[15].Contains("Bootstrapper sequence completed."));
        }
        public void RunShouldAssignRegionManagerToReturnedShell()
        {
            var bootstrapper = new DefaultStructureMapBootstrapper();

            bootstrapper.Run();

            Assert.IsNotNull(RegionManager.GetRegionManager(bootstrapper.BaseShell));
        }
 public void RunShouldNotFailIfReturnedNullShell()
 {
     var bootstrapper = new DefaultStructureMapBootstrapper { ShellObject = null };
     bootstrapper.Run();
 }