/V4/PrismLibrary/Desktop/Prism.UnityExtensions.Tests/UnityBootstrapperNullModuleManagerFixture.cs
C# | 82 lines | 52 code | 13 blank | 17 comment | 0 complexity | cc0f1b74e89404f225b96613c4f886dd MD5 | raw file
- //===================================================================================
- // Microsoft patterns & practices
- // Composite Application Guidance for Windows Presentation Foundation and Silverlight
- //===================================================================================
- // Copyright (c) Microsoft Corporation. All rights reserved.
- // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
- // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
- // LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- // FITNESS FOR A PARTICULAR PURPOSE.
- //===================================================================================
- // The example companies, organizations, products, domain names,
- // e-mail addresses, logos, people, places, and events depicted
- // herein are fictitious. No association with any real company,
- // organization, product, domain name, email address, logo, person,
- // places, or events is intended or should be inferred.
- //===================================================================================
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using Microsoft.Practices.Prism.Regions;
- using System.Windows;
- using Microsoft.Practices.ServiceLocation;
- using Microsoft.Practices.Unity;
- using Microsoft.Practices.Prism.UnityExtensions;
- using Microsoft.Practices.Prism.Logging;
-
-
- namespace Microsoft.Practices.Prism.UnityExtensions.Tests
- {
- [TestClass]
- public class UnityBootstrapperNullModuleManagerFixture
- {
- [TestMethod]
- public void RunShouldNotCallInitializeModulesWhenModuleManagerNotFound()
- {
- var bootstrapper = new NullModuleManagerBootstrapper();
-
- bootstrapper.Run();
-
- Assert.IsFalse(bootstrapper.InitializeModulesCalled);
- }
-
- private class NullModuleManagerBootstrapper : UnityBootstrapper
- {
- public bool InitializeModulesCalled;
-
- protected override void ConfigureContainer()
- {
- //base.RegisterDefaultTypesIfMissing();
-
- this.Container.AddNewExtension<UnityBootstrapperExtension>();
-
- Container.RegisterInstance<ILoggerFacade>(Logger);
-
- this.Container.RegisterInstance(this.ModuleCatalog);
- RegisterTypeIfMissing(typeof(IServiceLocator), typeof(UnityServiceLocatorAdapter), true);
- }
-
- protected override IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
- {
- return null;
- }
-
- protected override RegionAdapterMappings ConfigureRegionAdapterMappings()
- {
- return null;
- }
-
- protected override DependencyObject CreateShell()
- {
- return null;
- }
-
- protected override void InitializeModules()
- {
- this.InitializeModulesCalled = true;
- }
- }
- }
- }