コード例 #1
0
        public void KernelDefaultsToNull()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();
            var kernel       = bootstrapper.Kernel;

            Assert.IsNull(kernel);
        }
コード例 #2
0
        public void RunShouldCallConfigureRegionAdapterMappings()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureRegionAdapterMappingsCalled);
        }
コード例 #3
0
        public void RunShouldCallConfigureModuleCatalog()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

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

            bootstrapper.Run();

            Assert.IsNotNull(RegionManager.GetRegionManager(bootstrapper.BaseShell));
        }
コード例 #5
0
        public void RunShouldCallCreateShell()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.CreateShellCalled);
        }
コード例 #6
0
        public void RunShouldCallInitializeModules()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.InitializeModulesCalled);
        }
コード例 #7
0
        public void RunShouldNotFailIfReturnedNullShell()
        {
            var bootstrapper = new DefaultNinjectBootstrapper {
                ShellObject = null
            };

            bootstrapper.Run();
        }
コード例 #8
0
        public void RunConfiguresServiceLocatorProvider()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(ServiceLocator.Current is NinjectServiceLocatorAdapter);
        }
コード例 #9
0
        public void RunShouldCallConfigureDefaultRegionBehaviors()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureDefaultRegionBehaviorsCalled);
        }
コード例 #10
0
        public void RunShouldCallConfigureViewModelLocator()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureViewModelLocatorCalled);
        }
コード例 #11
0
        public void RunShouldCallConfigureKernel()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureKernelCalled);
        }
コード例 #12
0
        public void CreateKernelShouldInitializeKernel()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            IKernel kernel = bootstrapper.CallCreateKernel();

            Assert.IsNotNull(kernel);
            Assert.IsInstanceOfType(kernel, typeof(IKernel));
        }
コード例 #13
0
        public void RegisterFrameworkExceptionTypesShouldRegisterActivationException()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.CallRegisterFrameworkExceptionTypes();

            Assert.IsTrue(ExceptionExtensions.IsFrameworkExceptionRegistered(
                              typeof(ActivationException)));
        }
コード例 #14
0
        public void CreateKernelShouldInitializeKernel()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            IKernel kernel = bootstrapper.CallCreateKernel();

            Assert.NotNull(kernel);
            Assert.IsAssignableFrom <IKernel>(kernel);
        }
コード例 #15
0
        public void RunShouldLogAboutRegisteringFrameworkExceptionTypes()
        {
            const string expectedMessageText = "Registering Framework Exception Types.";
            var          bootstrapper        = new DefaultNinjectBootstrapper();

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
コード例 #16
0
        public void RunShouldLogAboutConfiguringRegionBehaviors()
        {
            const string expectedMessageText = "Configuring default region behaviors.";
            var          bootstrapper        = new DefaultNinjectBootstrapper();

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
コード例 #17
0
        public void ConfigureKernelAddsLoggerFacadeToKernel()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            var returnedCatalog = bootstrapper.Kernel.Get <ILoggerFacade>();

            Assert.IsNotNull(returnedCatalog);
        }
コード例 #18
0
        public void RunShouldLogAboutConfiguringViewModelLocator()
        {
            const string expectedMessageText = "Configuring the ViewModelLocator to use Ninject.";
            var          bootstrapper        = new DefaultNinjectBootstrapper();

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
コード例 #19
0
        public void RunShouldLogAboutConfiguringModuleCatalog()
        {
            const string expectedMessageText = "Configuring module catalog.";
            var          bootstrapper        = new DefaultNinjectBootstrapper();

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
コード例 #20
0
        public void RunShouldLogAboutCreatingTheShell()
        {
            const string expectedMessageText = "Creating the shell.";
            var          bootstrapper        = new DefaultNinjectBootstrapper();

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
コード例 #21
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            ThemeManager.ApplicationThemeName = Theme.Office2013Name;

            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();
        }
コード例 #22
0
        public void RunShouldLogLoggerCreationSuccess()
        {
            const string expectedMessageText = "Logger was created successfully.";
            var          bootstrapper        = new DefaultNinjectBootstrapper();

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
コード例 #23
0
        public void RunShouldLogAboutConfiguringKernel()
        {
            const string expectedMessageText = "Configuring the Ninject kernel.";
            var          bootstrapper        = new DefaultNinjectBootstrapper();

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.True(messages.Contains(expectedMessageText));
        }
コード例 #24
0
        public void RunAddsCompositionKernelToKernel()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            var createdKernel  = bootstrapper.CallCreateKernel();
            var returnedKernel = createdKernel.Get <IKernel>();

            Assert.IsNotNull(returnedKernel);
            Assert.AreEqual(typeof(StandardKernel), returnedKernel.GetType());
        }
コード例 #25
0
        public void RunShouldLogAboutRunCompleting()
        {
            const string expectedMessageText = "Bootstrapper sequence completed.";
            var          bootstrapper        = new DefaultNinjectBootstrapper();

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
コード例 #26
0
        public void RunShouldLogAboutInitializingModules()
        {
            const string expectedMessageText = "Initializing modules.";
            var          bootstrapper        = new DefaultNinjectBootstrapper();

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
コード例 #27
0
        public void ConfigureKernelAddsModuleCatalogToKernel()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            var returnedCatalog = bootstrapper.Kernel.Get <IModuleCatalog>();

            Assert.IsNotNull(returnedCatalog);
            Assert.IsTrue(returnedCatalog is ModuleCatalog);
        }
コード例 #28
0
        public void RunShouldNotLogAboutInitializingTheShellIfShellIsNotCreated()
        {
            const string expectedMessageText = "Initializing shell";
            var          bootstrapper        = new DefaultNinjectBootstrapper {
                ShellObject = null
            };

            bootstrapper.Run();
            var messages = bootstrapper.BaseLogger.Messages;

            Assert.IsFalse(messages.Contains(expectedMessageText));
        }
コード例 #29
0
        public void ConfigureKernelAddsNavigationTargetHandlerToKernel()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            var actual1 = bootstrapper.Kernel.Get <IRegionNavigationContentLoader>();
            var actual2 = bootstrapper.Kernel.Get <IRegionNavigationContentLoader>();

            Assert.IsNotNull(actual1);
            Assert.IsNotNull(actual2);
            Assert.AreSame(actual1, actual2);
        }
コード例 #30
0
        public void ConfigureKernelAddsRegionNavigationServiceToKernel()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            var actual1 = bootstrapper.Kernel.Get <IRegionNavigationService>();
            var actual2 = bootstrapper.Kernel.Get <IRegionNavigationService>();

            Assert.IsNotNull(actual1);
            Assert.IsNotNull(actual2);
            Assert.AreNotSame(actual1, actual2);
        }