コード例 #1
0
        public void ContainerDefaultsToNull()
        {
            var bootstrapper = new DefaultMunqBootstrapper();
            var container    = bootstrapper.Container;

            container.ShouldBeNull();
        }
コード例 #2
0
        public void RunShouldCallCreateShell()
        {
            var bootstrapper = new DefaultMunqBootstrapper();

            bootstrapper.Run();

            bootstrapper.CreateShellCalled.ShouldBeTrue();
        }
コード例 #3
0
        public void RunShouldCallConfigureModuleCatalog()
        {
            var bootstrapper = new DefaultMunqBootstrapper();

            bootstrapper.Run();

            bootstrapper.ConfigureModuleCatalogCalled.ShouldBeTrue();
        }
コード例 #4
0
        public void RunShouldAssignRegionManagerToReturnedShell()
        {
            var bootstrapper = new DefaultMunqBootstrapper();

            bootstrapper.Run();

            RegionManager.GetRegionManager(bootstrapper.BaseShell).ShouldNotBeNull();
        }
コード例 #5
0
        public void RunShouldCallConfigureRegionAdapterMappings()
        {
            var bootstrapper = new DefaultMunqBootstrapper();

            bootstrapper.Run();

            bootstrapper.ConfigureRegionAdapterMappingsCalled.ShouldBeTrue();
        }
コード例 #6
0
        public void RunShouldCallConfigureDefaultRegionBehaviors()
        {
            var bootstrapper = new DefaultMunqBootstrapper();

            bootstrapper.Run();

            bootstrapper.ConfigureDefaultRegionBehaviorsCalled.ShouldBeTrue();
        }
コード例 #7
0
        public void RunShouldCallInitializeModules()
        {
            var bootstrapper = new DefaultMunqBootstrapper();

            bootstrapper.Run();

            bootstrapper.InitializeModulesCalled.ShouldBeTrue();
        }
コード例 #8
0
        public void RunShouldCallConfigureViewModelLocator()
        {
            var bootstrapper = new DefaultMunqBootstrapper();

            bootstrapper.Run();

            bootstrapper.ConfigureViewModelLocatorCalled.ShouldBeTrue();
        }
コード例 #9
0
        public void RunConfiguresServiceLocatorProvider()
        {
            var bootstrapper = new DefaultMunqBootstrapper();

            bootstrapper.Run();

            ServiceLocator.Current.ShouldBeOfType <MunqServiceLocatorAdapter>();
        }
コード例 #10
0
        public void RunShouldCallConfigureContainer()
        {
            var bootstrapper = new DefaultMunqBootstrapper();

            bootstrapper.Run();

            bootstrapper.ConfigureContainerCalled.ShouldBeTrue();
        }
コード例 #11
0
        public void RunShouldNotFailIfReturnedNullShell()
        {
            var bootstrapper = new DefaultMunqBootstrapper {
                ShellObject = null
            };

            Should.NotThrow(() => bootstrapper.Run());
        }
コード例 #12
0
        public void CreateContainerShouldInitializeContainer()
        {
            var bootstrapper = new DefaultMunqBootstrapper();

            var container = bootstrapper.CallCreateContainer();

            container.ShouldNotBeNull();
            container.ShouldBeOfType <MunqContainerWrapper>();
        }
コード例 #13
0
        public void ConfigureContainerAddsLoggerFacadeToContainer()
        {
            var bootstrapper = new DefaultMunqBootstrapper();

            bootstrapper.Run();

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

            returnedCatalog.ShouldNotBeNull();
        }
コード例 #14
0
        public void RunAddsDependencyRegistrarToContainer()
        {
            var bootstrapper = new DefaultMunqBootstrapper();

            var createdContainer  = bootstrapper.CallCreateContainer();
            var returnedContainer = createdContainer.Resolve <IDependecyRegistrar>();

            returnedContainer.ShouldNotBeNull();
            returnedContainer.ShouldBeOfType <MunqContainerWrapper>();
        }
コード例 #15
0
        public void RunShouldLogAboutRunCompleting()
        {
            const string expectedMessageText = "Bootstrapper sequence completed.";
            var          bootstrapper        = new DefaultMunqBootstrapper();

            bootstrapper.Run();
            IList <string> messages = bootstrapper.BaseLogger.Messages;

            messages.ShouldContain(expectedMessageText);
        }
コード例 #16
0
        public void RunAddsCompositionContainerToContainer()
        {
            var bootstrapper = new DefaultMunqBootstrapper();

            var createdContainer  = bootstrapper.CallCreateContainer();
            var returnedContainer = createdContainer.Resolve <IIocContainer>();

            returnedContainer.ShouldNotBeNull();
            returnedContainer.ShouldBeOfType <MunqContainerWrapper>();
        }
コード例 #17
0
        public void RunShouldLogAboutRegisteringFrameworkExceptionTypes()
        {
            const string expectedMessageText = "Registering Framework Exception Types.";
            var          bootstrapper        = new DefaultMunqBootstrapper();

            bootstrapper.Run();
            IList <string> messages = bootstrapper.BaseLogger.Messages;

            messages.ShouldContain(expectedMessageText);
        }
コード例 #18
0
        public void RunShouldLogAboutInitializingModules()
        {
            const string expectedMessageText = "Initializing modules.";
            var          bootstrapper        = new DefaultMunqBootstrapper();

            bootstrapper.Run();
            IList <string> messages = bootstrapper.BaseLogger.Messages;

            messages.ShouldContain(expectedMessageText);
        }
コード例 #19
0
        public void RunShouldLogAboutInitializingTheShellIfShellCreated()
        {
            const string expectedMessageText = "Initializing the shell.";
            var          bootstrapper        = new DefaultMunqBootstrapper();

            bootstrapper.Run();
            IList <string> messages = bootstrapper.BaseLogger.Messages;

            messages.ShouldContain(expectedMessageText);
        }
コード例 #20
0
        public void RunShouldLogAboutConfiguringViewModelLocator()
        {
            const string expectedMessageText = "Configuring the ViewModelLocator to use Munq.";
            var          bootstrapper        = new DefaultMunqBootstrapper();

            bootstrapper.Run();
            IList <string> messages = bootstrapper.BaseLogger.Messages;

            messages.ShouldContain(expectedMessageText);
        }
コード例 #21
0
        public void RunShouldLogAboutConfiguringRegionBehaviors()
        {
            const string expectedMessageText = "Configuring default region behaviors.";
            var          bootstrapper        = new DefaultMunqBootstrapper();

            bootstrapper.Run();
            IList <string> messages = bootstrapper.BaseLogger.Messages;

            messages.ShouldContain(expectedMessageText);
        }
コード例 #22
0
        public void RunShouldLogAboutConfiguringModuleCatalog()
        {
            const string expectedMessageText = "Configuring module catalog.";
            var          bootstrapper        = new DefaultMunqBootstrapper();

            bootstrapper.Run();
            IList <string> messages = bootstrapper.BaseLogger.Messages;

            messages.ShouldContain(expectedMessageText);
        }
コード例 #23
0
        public void RunShouldLogAboutCreatingTheContainer()
        {
            const string expectedMessageText = "Creating Munq container.";
            var          bootstrapper        = new DefaultMunqBootstrapper();

            bootstrapper.Run();
            IList <string> messages = bootstrapper.BaseLogger.Messages;

            messages.ShouldContain(expectedMessageText);
        }
コード例 #24
0
        public void RunShouldLogLoggerCreationSuccess()
        {
            const string expectedMessageText = "Logger was created successfully.";
            var          bootstrapper        = new DefaultMunqBootstrapper();

            bootstrapper.Run();

            IList <string> messages = bootstrapper.BaseLogger.Messages;

            messages.ShouldContain(expectedMessageText);
        }
コード例 #25
0
        public void ConfigureContainerAddsModuleCatalogToContainer()
        {
            var bootstrapper = new DefaultMunqBootstrapper();

            bootstrapper.Run();

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

            returnedCatalog.ShouldNotBeNull();
            returnedCatalog.ShouldBeAssignableTo <ModuleCatalog>();
        }
コード例 #26
0
        public void RunShouldNotLogAboutInitializingTheShellIfShellIsNotCreated()
        {
            const string expectedMessageText = "Initializing shell";
            var          bootstrapper        = new DefaultMunqBootstrapper {
                ShellObject = null
            };

            bootstrapper.Run();
            IList <string> messages = bootstrapper.BaseLogger.Messages;

            messages.ShouldNotContain(expectedMessageText);
        }
コード例 #27
0
        public void ConfigureContainerAddsNavigationTargetHandlerToContainer()
        {
            var bootstrapper = new DefaultMunqBootstrapper();

            bootstrapper.Run();

            var actual1 = bootstrapper.BaseContainer.Resolve <IRegionNavigationContentLoader>();
            var actual2 = bootstrapper.BaseContainer.Resolve <IRegionNavigationContentLoader>();

            actual1.ShouldNotBeNull();
            actual2.ShouldNotBeNull();
            actual1.ShouldBeSameAs(actual2);
        }
コード例 #28
0
        public void ConfigureContainerAddsRegionNavigationServiceToContainer()
        {
            var bootstrapper = new DefaultMunqBootstrapper();

            bootstrapper.Run();

            var actual1 = bootstrapper.BaseContainer.Resolve <IRegionNavigationService>();
            var actual2 = bootstrapper.BaseContainer.Resolve <IRegionNavigationService>();

            actual1.ShouldNotBeNull();
            actual2.ShouldNotBeNull();
            actual1.ShouldNotBeSameAs(actual2);
        }
コード例 #29
0
        public void RunShouldInitializeContainer()
        {
            var bootstrapper = new DefaultMunqBootstrapper();
            var container    = bootstrapper.BaseContainer;

            container.ShouldBeNull();

            bootstrapper.Run();

            container = bootstrapper.BaseContainer;

            container.ShouldNotBeNull();
            container.ShouldBeOfType <MunqContainerWrapper>();
        }
コード例 #30
0
        public void ShouldLocateViewModelAndResolveWithContainer()
        {
            var bootstrapper = new DefaultMunqBootstrapper();

            bootstrapper.Run();

            bootstrapper.BaseContainer.Register <IService, MockService>();

            var view = new MockView();

            view.DataContext.ShouldBeNull();

            ViewModelLocator.SetAutoWireViewModel(view, value: true);

            view.DataContext.ShouldNotBeNull();
            view.DataContext.ShouldBeOfType <MockViewModel>();
            ((MockViewModel)view.DataContext).MockService.ShouldNotBeNull();
        }