/// <summary>
        /// Called when the applications starts. Makes a distinction between debug and release mode
        /// </summary>
        /// <param name="e">
        /// the event argument
        /// </param>
        protected override void OnStartup(StartupEventArgs e)
        {
            // Set the Theme of the application
            ThemeManager.ApplicationThemeName = Theme.SevenName;
            AppliedTheme.ThemeName            = Theme.SevenName;
            base.OnStartup(e);

            this.ShutdownMode = ShutdownMode.OnExplicitShutdown;

            if (UpdateInstaller.CheckInstallAndVerifyIfTheImeShallShutdown())
            {
                Current.Shutdown();
                return;
            }

            DXSplashScreen.Show <Views.SplashScreenView>();
            DXSplashScreen.SetState("Starting COMET");

#if (DEBUG)
            RunInDebugMode();
#else
            RunInReleaseMode();
#endif

            this.ShutdownMode = ShutdownMode.OnMainWindowClose;

            DXSplashScreen.SetState("Preparing Main Window");

            Current.MainWindow.Show();
            DXSplashScreen.Close();
        }
        public void VerifyIncompatibleIMEUpdate()
        {
            this.SetupInstallerFile(false);

            new UpdateFileSystemService().ImeDownloadPath = new DirectoryInfo(this.imeDownloadTestPath);
            Assert.IsFalse(UpdateInstaller.CheckInstallAndVerifyIfTheImeShallShutdown(this.viewInvoker.Object));

            this.viewInvoker.Verify(x => x.ShowMessageBox(
                                        It.IsAny <string>(), It.IsAny <string>(), MessageBoxButton.YesNo, MessageBoxImage.Information), Times.Never);

            this.commandRunner.Verify(x => x.RunAsAdmin(It.IsAny <string>()), Times.Never);
        }
        public void VerifyIMEUpdate()
        {
            this.viewInvoker.Setup(x => x.ShowMessageBox(
                                       It.IsAny <string>(), It.IsAny <string>(), MessageBoxButton.YesNo, MessageBoxImage.Information)).Returns(MessageBoxResult.Yes);

            this.SetupInstallerFile(true);

            Assert.IsTrue(UpdateInstaller.CheckInstallAndVerifyIfTheImeShallShutdown(this.viewInvoker.Object, this.commandRunner.Object));

            this.viewInvoker.Verify(x => x.ShowMessageBox(
                                        It.IsAny <string>(), It.IsAny <string>(), MessageBoxButton.YesNo, MessageBoxImage.Information), Times.Once);

            this.commandRunner.Verify(x => x.RunAsAdmin(It.IsAny <string>()), Times.Once);
        }
        public void VerifyCheckInstallAndVerifyIfTheImeShallShutdown()
        {
            Assert.IsFalse(UpdateInstaller.CheckInstallAndVerifyIfTheImeShallShutdown(this.viewInvoker.Object));
            this.viewInvoker.Verify(x => x.ShowDialog(It.IsAny <UpdateDownloaderInstaller>()), Times.Never);

            var dataPath = new DirectoryInfo(Path.Combine(TestContext.CurrentContext.TestDirectory, "ViewModels", "PluginMockData"));

            foreach (var file in dataPath.EnumerateFiles())
            {
                var destination = Path.Combine(this.downloadPath, Path.GetFileNameWithoutExtension(file.Name));

                if (!Directory.Exists(destination))
                {
                    Directory.CreateDirectory(destination);
                }

                File.Copy(file.FullName, Path.Combine(destination, file.Name), true);
            }

            UpdateInstaller.CheckInstallAndVerifyIfTheImeShallShutdown(this.viewInvoker.Object);
            this.viewInvoker.Verify(x => x.ShowDialog(It.IsAny <UpdateDownloaderInstaller>()), Times.Once);
        }