public void RunShouldNotLogAboutInitializingTheShellIfShellIsNotCreated() { const string expectedMessageText = "Initializing shell"; var bootstrapper = new DefaultAutofacBootstrapper { ShellObject = null }; bootstrapper.Run(); var messages = bootstrapper.BaseLogger.Messages; Assert.IsFalse(messages.Contains(expectedMessageText)); }
public void RunRegistersTypeForIRegionBehaviorFactory() { var bootstrapper = new DefaultAutofacBootstrapper(); bootstrapper.Run(); var regionBehaviorFactory = bootstrapper.BaseContainer.Resolve <IRegionBehaviorFactory>(); Assert.IsNotNull(regionBehaviorFactory); Assert.IsTrue(regionBehaviorFactory.GetType().IsClass); Assert.IsTrue(regionBehaviorFactory.GetType().GetInterfaces().Contains(typeof(IRegionBehaviorFactory))); }
public void RunRegistersTypeForIEventAggregator() { var bootstrapper = new DefaultAutofacBootstrapper(); bootstrapper.Run(); var eventAggregator = bootstrapper.BaseContainer.Resolve <IEventAggregator>(); Assert.IsNotNull(eventAggregator); Assert.IsTrue(eventAggregator.GetType().IsClass); Assert.IsTrue(eventAggregator.GetType().GetInterfaces().Contains(typeof(IEventAggregator))); }
public void RunRegistersTypeForIModuleInitializer() { var bootstrapper = new DefaultAutofacBootstrapper(); bootstrapper.Run(); var moduleInitializer = bootstrapper.BaseContainer.Resolve <IModuleInitializer>(); Assert.IsNotNull(moduleInitializer); Assert.IsTrue(moduleInitializer.GetType().IsClass); Assert.IsTrue(moduleInitializer.GetType().GetInterfaces().Contains(typeof(IModuleInitializer))); }
public void RunRegistersInstanceOfIModuleCatalog() { var bootstrapper = new DefaultAutofacBootstrapper(); bootstrapper.Run(); var moduleCatalog = bootstrapper.BaseContainer.Resolve <IModuleCatalog>(); Assert.IsNotNull(moduleCatalog); Assert.IsTrue(moduleCatalog.GetType().IsClass); Assert.IsTrue(moduleCatalog.GetType().GetInterfaces().Contains(typeof(IModuleCatalog))); }
public void RunRegistersInstanceOfILoggerFacade() { var bootstrapper = new DefaultAutofacBootstrapper(); bootstrapper.Run(); var logger = bootstrapper.BaseContainer.Resolve <ILoggerFacade>(); Assert.IsNotNull(logger); Assert.IsTrue(logger.GetType().IsClass); Assert.IsTrue(logger.GetType().GetInterfaces().Contains(typeof(ILoggerFacade))); }
public void ConfigureContainerAddsRegionNavigationJournalToContainer() { var bootstrapper = new DefaultAutofacBootstrapper(); bootstrapper.Run(); var actual1 = bootstrapper.BaseContainer.Resolve <IRegionNavigationJournal>(); var actual2 = bootstrapper.BaseContainer.Resolve <IRegionNavigationJournal>(); Assert.IsNotNull(actual1); Assert.IsNotNull(actual2); Assert.AreNotSame(actual1, actual2); }
public void ConfigureContainerAddsNavigationTargetHandlerToContainer() { var bootstrapper = new DefaultAutofacBootstrapper(); bootstrapper.Run(); var actual1 = bootstrapper.BaseContainer.Resolve <IRegionNavigationContentLoader>(); var actual2 = bootstrapper.BaseContainer.Resolve <IRegionNavigationContentLoader>(); Assert.IsNotNull(actual1); Assert.IsNotNull(actual2); Assert.AreSame(actual1, actual2); }
public void RunRegistersTypeForIServiceLocator() { var bootstrapper = new DefaultAutofacBootstrapper(); bootstrapper.Run(); var serviceLocator = bootstrapper.BaseContainer.Resolve <IServiceLocator>(); Assert.IsNotNull(serviceLocator); Assert.IsTrue(serviceLocator.GetType().IsClass); Assert.AreEqual(typeof(AutofacServiceLocatorAdapter), serviceLocator.GetType()); Assert.IsTrue(serviceLocator.GetType().GetInterfaces().Contains(typeof(IServiceLocator))); }
public void RunShouldInitializeContainer() { var bootstrapper = new DefaultAutofacBootstrapper(); var container = bootstrapper.BaseContainer; Assert.IsNull(container); bootstrapper.Run(); container = bootstrapper.BaseContainer; Assert.IsNotNull(container); Assert.IsInstanceOfType(container, typeof(IContainer)); }
public void RunShouldCallTheMethodsInOrder() { var bootstrapper = new DefaultAutofacBootstrapper(); bootstrapper.Run(); Assert.AreEqual("CreateLogger", bootstrapper.MethodCalls[0]); Assert.AreEqual("CreateModuleCatalog", bootstrapper.MethodCalls[1]); Assert.AreEqual("ConfigureModuleCatalog", bootstrapper.MethodCalls[2]); Assert.AreEqual("CreateContainerBuilder", bootstrapper.MethodCalls[3]); Assert.AreEqual("ConfigureContainerBuilder", bootstrapper.MethodCalls[4]); Assert.AreEqual("CreateContainer", bootstrapper.MethodCalls[5]); Assert.AreEqual("ConfigureServiceLocator", bootstrapper.MethodCalls[6]); Assert.AreEqual("CreateContainerBuilder", bootstrapper.MethodCalls[7]); // update container Assert.AreEqual("ConfigureRegionAdapterMappings", bootstrapper.MethodCalls[8]); Assert.AreEqual("ConfigureDefaultRegionBehaviors", bootstrapper.MethodCalls[9]); Assert.AreEqual("RegisterFrameworkExceptionTypes", bootstrapper.MethodCalls[10]); Assert.AreEqual("CreateShell", bootstrapper.MethodCalls[11]); Assert.AreEqual("InitializeShell", bootstrapper.MethodCalls[12]); Assert.AreEqual("InitializeModules", bootstrapper.MethodCalls[13]); }
public void CanRunBootstrapper() { var bootstrapper = new DefaultAutofacBootstrapper(); bootstrapper.Run(); }