public void ShouldRegisterDefaultTypeMappings() { var bootstrapper = new MockedBootstrapper(); bootstrapper.MockUnityContainer.ResolveBag.Add(typeof(IModuleCatalog), bootstrapper.ModuleEnumerator); bootstrapper.MockUnityContainer.ResolveBag.Add(typeof(IModuleLoader), new MockModuleLoader()); bootstrapper.Run(); Assert.IsTrue(bootstrapper.MockUnityContainer.Instances.ContainsKey(typeof(ILoggerFacade))); Assert.AreSame(bootstrapper.Logger, bootstrapper.MockUnityContainer.Instances[typeof(ILoggerFacade)]); Assert.IsTrue(bootstrapper.MockUnityContainer.Instances.ContainsKey(typeof(IUnityContainer))); Assert.AreSame(bootstrapper.MockUnityContainer, bootstrapper.MockUnityContainer.Instances[typeof(IUnityContainer)]); Assert.IsTrue(bootstrapper.MockUnityContainer.Types.ContainsKey(typeof(IContainerFacade))); Assert.AreEqual(typeof(UnityContainerAdapter), bootstrapper.MockUnityContainer.Types[typeof(IContainerFacade)]); Assert.IsTrue(bootstrapper.MockUnityContainer.Types.ContainsKey(typeof(IModuleLoader))); Assert.AreEqual(typeof(ModuleLoader), bootstrapper.MockUnityContainer.Types[typeof(IModuleLoader)]); Assert.IsTrue(bootstrapper.MockUnityContainer.Types.ContainsKey(typeof(IEventAggregator))); Assert.AreEqual(typeof(EventAggregator), bootstrapper.MockUnityContainer.Types[typeof(IEventAggregator)]); Assert.IsTrue(bootstrapper.MockUnityContainer.Instances.ContainsKey(typeof(IModuleCatalog))); Assert.AreSame(bootstrapper.ModuleEnumerator, bootstrapper.MockUnityContainer.Instances[typeof(IModuleCatalog)]); }
public void ShouldCallInitializeOnModuleLoader() { var bootstrapper = new MockedBootstrapper(); var moduleLoader = new MockModuleLoader(); bootstrapper.MockUnityContainer.ResolveBag.Add(typeof(IModuleCatalog), new MockModuleEnumerator()); bootstrapper.MockUnityContainer.ResolveBag.Add(typeof(IModuleLoader), moduleLoader); bootstrapper.Run(); Assert.IsTrue(moduleLoader.InitializeCalled); }
public void ShouldCallInitializeOnModuleLoaderWithStartupModules() { var bootstrapper = new MockedBootstrapper(); var moduleLoader = new MockModuleLoader(); bootstrapper.ModuleEnumerator.StartupLoadedModules = new[] { new ModuleInfo("asm", "type", "name") }; bootstrapper.MockUnityContainer.ResolveBag.Add(typeof(IModuleCatalog), bootstrapper.ModuleEnumerator); bootstrapper.MockUnityContainer.ResolveBag.Add(typeof(IModuleLoader), moduleLoader); bootstrapper.Run(); Assert.IsNotNull(moduleLoader.InitializeArgumentModuleInfos); Assert.AreEqual(1, moduleLoader.InitializeArgumentModuleInfos.Length); Assert.AreEqual("name", moduleLoader.InitializeArgumentModuleInfos[0].ModuleName); }
public void ShouldCallGetStartupLoadedModules() { var bootstrapper = new MockedBootstrapper(); bootstrapper.MockUnityContainer.ResolveBag.Add(typeof(IModuleCatalog), bootstrapper.ModuleEnumerator); bootstrapper.MockUnityContainer.ResolveBag.Add(typeof(IModuleLoader), new MockModuleLoader()); bootstrapper.Run(); Assert.IsTrue(bootstrapper.ModuleEnumerator.GetStartupLoadedModulesCalled); }