public void NullLoggerThrows()
        {
            var bootstrapper = new DefaultBootstrapper();
            bootstrapper.ReturnNullDefaultLogger = true;

            AssertExceptionThrownOnRun(bootstrapper, typeof (InvalidOperationException), "ILoggerFacade");
        }
        public void CanRegisterTypeIfMissingAsTransient()
        {
            var bootstrapper = new DefaultBootstrapper();
            bootstrapper.Run();

            var service = bootstrapper.Container.TryResolve<IService>();
            Assert.IsNotNull(service);
        }
        public void NotOvewrittenGetModuleEnumeratorThrowsOnDefaultModuleInitialization()
        {
            var bootstrapper = new DefaultBootstrapper();
            bootstrapper.OverrideGetModuleEnumerator = false;
            bootstrapper.CallBaseModuleInitialization = true;

            AssertExceptionThrownOnRun(bootstrapper, typeof (InvalidOperationException), "IModuleCatalog");
        }
        public void GetLoggerShouldHaveDefault()
        {
            var bootstrapper = new DefaultBootstrapper();
            Assert.IsNull(bootstrapper.DefaultLogger);
            bootstrapper.Run();

            Assert.IsNotNull(bootstrapper.DefaultLogger);
            Assert.IsInstanceOfType(bootstrapper.DefaultLogger, typeof (Log4NetLogger));
        }
 public void CanRunBootstrapper()
 {
     var bootstrapper = new DefaultBootstrapper();
     bootstrapper.Run();
 }
        public void ShouldRegisterDefaultMappings()
        {
            var bootstrapper = new DefaultBootstrapper();
            bootstrapper.Run();

            Assert.IsNotNull(bootstrapper.DefaultRegionAdapterMappings);
            Assert.IsNotNull(bootstrapper.DefaultRegionAdapterMappings.GetMapping(typeof (ItemsControl)));
            Assert.IsNotNull(bootstrapper.DefaultRegionAdapterMappings.GetMapping(typeof (ContentControl)));
            Assert.IsNotNull(bootstrapper.DefaultRegionAdapterMappings.GetMapping(typeof (Selector)));
        }
 public void ShouldNotFailIfReturnedNullShell()
 {
     var bootstrapper = new DefaultBootstrapper {CreateShellReturnValue = null};
     bootstrapper.Run();
 }
 public void CanCreateBootstrapper()
 {
     var bs = new DefaultBootstrapper();
     Assert.IsNotNull(bs);
 }
        public void ShouldAssignRegionManagerToReturnedShell()
        {
            var bootstrapper = new DefaultBootstrapper();
            var shell = new DependencyObject();
            bootstrapper.CreateShellReturnValue = shell;

            Assert.IsNull(RegionManager.GetRegionManager(shell));

            bootstrapper.Run();

            Assert.IsNotNull(RegionManager.GetRegionManager(shell));
        }
        public void ShouldGetStartupModulesFromModuleEnumerator()
        {
            var bootstrapper = new DefaultBootstrapper();

            bootstrapper.CallBaseConfigureContainer = true;
            bootstrapper.CallBaseModuleInitialization = true;
            bootstrapper.RegisterMockModuleLoader = true;

            bootstrapper.Run(false); //should be true I think.

            var enumerator = (MockModuleCatalog) bootstrapper.ModuleCatalog;
            //Assert.IsTrue(enumerator.GetStartupLoadedModulesCalled);
        }
        public void ShouldCallInitializeModules()
        {
            var bootstrapper = new DefaultBootstrapper();
            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.InitializeModulesCalled);
        }
        public void ShouldCallGetLogger()
        {
            var bootstrapper = new DefaultBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.GetLoggerCalled);
        }
        public void ShouldCallCreateSell()
        {
            var bootstrapper = new DefaultBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.CreateShellCalled);
        }
        public void ShouldCallConfigureTypeMappings()
        {
            var bootstrapper = new DefaultBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureContainerCalled);
        }
        public void ShouldCallConfigureRegionAdapterMappings()
        {
            var bootstrapper = new DefaultBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureRegionAdapterMappingsCalled);
        }
        public void ShouldInitializeContainer()
        {
            var bootstrapper = new DefaultBootstrapper();
            IWindsorContainer container = bootstrapper.GetBaseContainer();

            Assert.IsNull(container);

            bootstrapper.Run();

            container = bootstrapper.GetBaseContainer();

            Assert.IsNotNull(container);
            Assert.IsInstanceOfType(container, typeof (WindsorContainer));
        }
 public void ResolveAnUnregisteredTypeShouldWork()
 {
     var bootstrapper = new DefaultBootstrapper();
     bootstrapper.Run(true);
     var instance = ServiceLocator.Current.GetInstance<DelayedRegionCreationBehavior>();
     Assert.IsNotNull(instance);
 }