public void RunShouldNotFailIfReturnedNullShell()
        {
            var bootstrapper = new DefaultNinjectBootstrapper {
                ShellObject = null
            };

            bootstrapper.Run();
        }
        public void RunShouldCallConfigureViewModelLocator()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureViewModelLocatorCalled);
        }
        public void RunConfiguresServiceLocatorProvider()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(ServiceLocator.Current is NinjectServiceLocatorAdapter);
        }
        public void RunShouldCallCreateShell()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.CreateShellCalled);
        }
        public void RunShouldCallConfigureKernel()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureKernelCalled);
        }
        public void RunShouldCallInitializeModules()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.InitializeModulesCalled);
        }
        public void RunShouldCallConfigureModuleCatalog()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureModuleCatalogCalled);
        }
        public void RunShouldCallConfigureDefaultRegionBehaviors()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureDefaultRegionBehaviorsCalled);
        }
        public void RunShouldCallConfigureRegionAdapterMappings()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            Assert.IsTrue(bootstrapper.ConfigureRegionAdapterMappingsCalled);
        }
        public void RunShouldAssignRegionManagerToReturnedShell()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            Assert.IsNotNull(RegionManager.GetRegionManager(bootstrapper.BaseShell));
        }
        public void ConfigureKernelAddsLoggerFacadeToKernel()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

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

            Assert.IsNotNull(returnedCatalog);
        }
예제 #12
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            ThemeManager.ApplicationThemeName = Theme.Office2013Name;

            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();
        }
        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));
        }
        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));
        }
        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));
        }
        public void RunShouldLogAboutInitializingModules()
        {
            const string expectedMessageText = "Initializing modules.";
            var          bootstrapper        = new DefaultNinjectBootstrapper();

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

            Assert.IsTrue(messages.Contains(expectedMessageText));
        }
        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));
        }
        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));
        }
        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));
        }
        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));
        }
        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));
        }
        public void ConfigureKernelAddsModuleCatalogToKernel()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

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

            Assert.IsNotNull(returnedCatalog);
            Assert.IsTrue(returnedCatalog is ModuleCatalog);
        }
        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));
        }
        public void ConfigureKernelAddsRegionNavigationJournalEntryToKernel()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

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

            Assert.NotNull(actual1);
            Assert.NotNull(actual2);
            Assert.NotSame(actual1, actual2);
        }
        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);
        }
        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);
        }
        public void RunShouldInitializeKernel()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();
            var kernel       = bootstrapper.Kernel;

            Assert.IsNull(kernel);

            bootstrapper.Run();

            kernel = bootstrapper.Kernel;

            Assert.IsNotNull(kernel);
            Assert.IsInstanceOfType(kernel, typeof(IKernel));
        }
        public void RunShouldInitializeKernel()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();
            var kernel       = bootstrapper.Kernel;

            Assert.Null(kernel);

            bootstrapper.Run();

            kernel = bootstrapper.Kernel;

            Assert.NotNull(kernel);
            Assert.IsAssignableFrom <IKernel>(kernel);
        }
        public void ShouldLocateViewModelAndResolveWithKernel()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            bootstrapper.Kernel.Bind <IService>().To <MockService>();

            var view = new MockView();

            Assert.IsNull(view.DataContext);

            ViewModelLocator.SetAutoWireViewModel(view, true);
            Assert.IsNotNull(view.DataContext);
            Assert.IsInstanceOfType(view.DataContext, typeof(MockViewModel));

            Assert.IsNotNull(((MockViewModel)view.DataContext).MockService);
        }
        public void RunShouldCallTheMethodsInOrder()
        {
            var bootstrapper = new DefaultNinjectBootstrapper();

            bootstrapper.Run();

            Assert.AreEqual("CreateLogger", bootstrapper.MethodCalls[0]);
            Assert.AreEqual("CreateModuleCatalog", bootstrapper.MethodCalls[1]);
            Assert.AreEqual("ConfigureModuleCatalog", bootstrapper.MethodCalls[2]);
            Assert.AreEqual("CreateKernel", bootstrapper.MethodCalls[3]);
            Assert.AreEqual("ConfigureKernel", bootstrapper.MethodCalls[4]);
            Assert.AreEqual("ConfigureServiceLocator", bootstrapper.MethodCalls[5]);
            Assert.AreEqual("ConfigureViewModelLocator", bootstrapper.MethodCalls[6]);
            Assert.AreEqual("ConfigureRegionAdapterMappings", bootstrapper.MethodCalls[7]);
            Assert.AreEqual("ConfigureDefaultRegionBehaviors", bootstrapper.MethodCalls[8]);
            Assert.AreEqual("RegisterFrameworkExceptionTypes", bootstrapper.MethodCalls[9]);
            Assert.AreEqual("CreateShell", bootstrapper.MethodCalls[10]);
            Assert.AreEqual("InitializeShell", bootstrapper.MethodCalls[11]);
            Assert.AreEqual("InitializeModules", bootstrapper.MethodCalls[12]);
        }