Ejemplo n.º 1
0
        public void Parse_TagName()
        {
            RunParameters p = new RunParameters();

            p.Parse(GenerateCommandLineArgs(@"/tag:Foobar"));
            Assert.AreEqual("Foobar", p.TagName);
        }
Ejemplo n.º 2
0
        public async Task <FilePath?> Run(
            IGroupRun groupRun,
            PatcherPrepBundle[] patchers,
            CancellationToken cancellation,
            FilePath?sourcePath,
            RunParameters runParameters)
        {
            for (int i = 0; i < patchers.Length; i++)
            {
                var patcher = patchers[i];

                var nextPath = await RunAPatcher.Run(
                    groupRun,
                    patcher,
                    cancellation,
                    sourcePath,
                    runParameters).ConfigureAwait(false);

                if (nextPath == null)
                {
                    return(null);
                }

                sourcePath = nextPath;
            }

            return(sourcePath);
        }
Ejemplo n.º 3
0
        public void Parse_BrowserShortLongCasing()
        {
            //IE
            RunParameters p = new RunParameters();

            p.Parse(GenerateCommandLineArgs(@"/browser:IE"));
            Assert.IsInstanceOfType(p.Browser, typeof(IEBrowser));

            p.Parse(GenerateCommandLineArgs(@"/browser:INTERNETEXPLORER"));
            Assert.IsInstanceOfType(p.Browser, typeof(IEBrowser));

            p.Parse(GenerateCommandLineArgs(@"/browser:internetexplorer"));
            Assert.IsInstanceOfType(p.Browser, typeof(IEBrowser));


            //FIREFOX
            p.Parse(GenerateCommandLineArgs(@"/browser:FF"));
            Assert.IsInstanceOfType(p.Browser, typeof(FireFoxBrowser));

            p.Parse(GenerateCommandLineArgs(@"/browser:FIREFOX"));
            Assert.IsInstanceOfType(p.Browser, typeof(FireFoxBrowser));

            p.Parse(GenerateCommandLineArgs(@"/browser:firefox"));
            Assert.IsInstanceOfType(p.Browser, typeof(FireFoxBrowser));
        }
Ejemplo n.º 4
0
        public async Task MinimumAzureFunctionsDatabricksProject_WithEmbeddedTimer_ReportsAsMetricPeriodically()
        {
            ApplicationInsightsConfig applicationInsightsConfig = _config.GetApplicationInsightsConfig();
            var parameters = RunParameters.CreateNotebookParams(Enumerable.Empty <KeyValuePair <string, string> >());

            using (var project = AzureFunctionsDatabricksProject.StartNew(_config, _outputWriter))
            {
                using (var client = DatabricksClient.CreateClient(project.DatabricksConfig.BaseUrl, project.DatabricksConfig.SecurityToken))
                {
                    // Act
                    await client.Jobs.RunNow(project.DatabricksConfig.JobId, parameters);
                    await WaitUntilDatabricksJobRunIsCompleted(client, project.DatabricksConfig.JobId);
                }
            }

            // Assert
            using (ApplicationInsightsDataClient client = CreateApplicationInsightsClient(applicationInsightsConfig.ApiKey))
            {
                await RetryAssertUntilTelemetryShouldBeAvailableAsync(async() =>
                {
                    const string past10MinFilter = "PT0.1H";
                    var bodySchema = new MetricsPostBodySchema(
                        id: Guid.NewGuid().ToString(),
                        parameters: new MetricsPostBodySchemaParameters($"customMetrics/{applicationInsightsConfig.MetricName}", timespan: past10MinFilter));

                    IList <MetricsResultsItem> results =
                        await client.Metrics.GetMultipleAsync(applicationInsightsConfig.ApplicationId, new List <MetricsPostBodySchema> {
                        bodySchema
                    });

                    Assert.NotEmpty(results);
                    Assert.All(results, result => Assert.NotNull(result.Body.Value));
                }, timeout : TimeSpan.FromMinutes(2));
            }
        }
Ejemplo n.º 5
0
        public async Task Run(
            IGroupRun[] groups,
            CancellationToken cancellation,
            DirectoryPath outputDir,
            RunParameters runParameters,
            FilePath?sourcePath = null)
        {
            _print.Print(groups);

            cancellation.ThrowIfCancellationRequested();
            ResetWorkingDirectory.Reset();

            if (groups.Length == 0)
            {
                return;
            }

            cancellation.ThrowIfCancellationRequested();
            EnsureSourcePathExists.Ensure(sourcePath);

            cancellation.ThrowIfCancellationRequested();

            await RunAllGroups.Run(
                groups,
                cancellation,
                outputDir,
                runParameters,
                sourcePath).ConfigureAwait(false);
        }
Ejemplo n.º 6
0
        private static async Task Run(RunParameters parameters)
        {
            var options = AppOptionsProvider.LoadOptions();

            await UpdateTheme(options, parameters.Theme);

            if (File.Exists(parameters.Source))
            {
                await Convert(new FileInfo(parameters.Source).DirectoryName !, parameters.Source, options, parameters);
            }
            else if (Directory.Exists(parameters.Source))
            {
                foreach (var file in Directory.GetFiles(parameters.Source, "*.md", SearchOption.AllDirectories).OrderBy(x => x))
                {
                    try
                    {
                        await Convert(new DirectoryInfo(parameters.Source).FullName !, file, options, parameters);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine($"Unable to convert {file}: {ex.Message}");
                    }
                }
            }
            else
            {
                Exit(-3, $"Source file or directory '{parameters.Source}' does not exist.");
            }
        }
        async void RunInUnitySimulation()
        {
            m_RunParameters = new RunParameters
            {
                runName              = m_RunNameField.value,
                totalIterations      = m_TotalIterationsField.value,
                instanceCount        = m_InstanceCountField.value,
                sysParamIndex        = m_SysParamIndex,
                scenarioConfig       = (TextAsset)m_ScenarioConfigField.value,
                currentOpenScenePath = SceneManager.GetSceneAt(0).path,
                currentScenario      = FindObjectOfType <ScenarioBase>()
            };
            var runGuid = Guid.NewGuid();

            PerceptionEditorAnalytics.ReportRunInUnitySimulationStarted(
                runGuid,
                m_RunParameters.totalIterations,
                m_RunParameters.instanceCount,
                null);
            try
            {
                ValidateSettings();
                CreateLinuxBuildAndZip();
                await StartUnitySimulationRun(runGuid);
            }
            catch (Exception e)
            {
                EditorUtility.ClearProgressBar();
                PerceptionEditorAnalytics.ReportRunInUnitySimulationFailed(runGuid, e.Message);
                throw;
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Runs the job now.
 /// </summary>
 /// <param name="jobId">The job identifier.</param>
 /// <param name="runParameters">The run parameters.</param>
 /// <returns>RunIdentifier.</returns>
 public RunIdentifier JobsRunNow(long jobId, RunParameters runParameters)
 {
     using (var client = DatabricksClient.CreateClient(this.baseUrl, this.token))
     {
         return(client.Jobs.RunNow(jobId, runParameters).Result);
     }
 }
Ejemplo n.º 9
0
        public void Parse_Help()
        {
            RunParameters p = new RunParameters();

            p.Parse(GenerateCommandLineArgs(@"/?"));
            Assert.IsTrue(p.PrintHelp);
        }
Ejemplo n.º 10
0
        public void Parse_1Param()
        {
            RunParameters p = new RunParameters();

            p.Parse(GenerateCommandLineArgs(@"/path:D:\DD\Tests\myWebsites"));
            Assert.AreEqual(@"D:\DD\Tests\myWebsites", p.WebSitePath);
        }
        private static void WarningUpgrade()
        {
            // WARNING: Target file not found in backup.
            var testXmlFile = Path.Combine(Directory.GetCurrentDirectory(), @"Web.config");
            var fileList    = new List <TargetFileInfo>
            {
                new TargetFileInfo(
                    testXmlFile,
                    testXmlFile + ".upgrade"
                    )
            };

            var parameters = new RunParameters("TestProduct", new InstallerVersion("1.10.1"), new InstallerVersion(String.Empty),
                                               fileList);

            parameters.DumpToLog();

            {
                var stageUpgrade = new StageUpgrade(parameters, null);
                var retCode      = stageUpgrade.Run();
                Assert.AreEqual(0, retCode);
            }

            // WARNING: Target file not found: NotExist.config
            testXmlFile = @"NotExist.config";
            var upgradeFile = Path.Combine(Directory.GetCurrentDirectory(), @"Config1.xml.upgrade");

            fileList = new List <TargetFileInfo>
            {
                new TargetFileInfo(
                    testXmlFile,
                    upgradeFile
                    )
            };

            parameters = new RunParameters("TestProduct", new InstallerVersion("1.10.1"), new InstallerVersion("1.0.1"), fileList);

            {
                var stageUpgrade = new StageUpgrade(parameters, null);
                var retCode      = stageUpgrade.Run();
                Assert.AreEqual(0, retCode);
            }

            // WARNING: Upgrade file info not found.
            fileList = new List <TargetFileInfo>
            {
                new TargetFileInfo(
                    testXmlFile,
                    testXmlFile + ".upgrade"
                    )
            };

            parameters = new RunParameters("TestProduct", new InstallerVersion("1.10.1"), new InstallerVersion("1.0.1"), fileList);

            {
                var stageUpgrade = new StageUpgrade(parameters, null);
                var retCode      = stageUpgrade.Run();
                Assert.AreEqual(0, retCode);
            }
        }
Ejemplo n.º 12
0
        //private void LogRunEnd(DateTime startOfRun)
        //{
        //    Type t = typeof (RunTracker);
        //    MethodInfo method = t.GetMethod("RunCompleted", BindingFlags.Public | BindingFlags.Static);

        //    try
        //    {
        //        method.Invoke(null, new object[] {Scenario.Project, Scenario, startOfRun});
        //    }
        //    catch(Exception)
        //    {
        //        method.Invoke(null, new object[] { Scenario.Project, startOfRun });
        //    }
        //}

        private void ApplyRunParameters(RunParameters parameters)
        {
            HashSet <string> skipKeys = new HashSet <string>(new [] { RUN_NAME_KEY });

            RunningConfiguration configuration = Scenario.CurrentConfiguration;
            Type configType = configuration.GetType();

            foreach (var entry in parameters.Params.Where(kvp => !skipKeys.Contains(kvp.Key)))
            {
                var ri  = ReflectedItem.NewItem(entry.Key, configuration);
                var val = entry.Value;

                if (ri.itemType == typeof(DateTime))
                {
                    val = DateTime.ParseExact(entry.Value.ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                }
                else if (ri.itemType == typeof(InputSet))
                {
                    val = Scenario.Network.InputSets.FirstOrDefault(ipSet => ipSet.Name == (string)entry.Value);
                }
                else if (ri.itemType == typeof(TimeStep))
                {
                    val = TimeStep.FromName((string)entry.Value);
                }

                ri.itemValue = val;
            }
        }
Ejemplo n.º 13
0
        public void Parse_BrowserAndPath()
        {
            RunParameters p = new RunParameters();

            p.Parse(GenerateCommandLineArgs(@"/browser:ie /path:D:\DD\Tests\myWebsites"));
            Assert.AreEqual(@"D:\DD\Tests\myWebsites", p.WebSitePath);
            Assert.IsInstanceOfType(p.Browser, typeof(IEBrowser));
        }
Ejemplo n.º 14
0
 public void PatcherNameShouldBeSanitizedName(
     IGroupRun groupRun,
     IPatcherRun patcher,
     FilePath?sourcePath,
     RunParameters runParameters,
     string sanitize,
     RunArgsConstructor sut)
 {
     sut.PatcherNameSanitizer.Sanitize(default !).ReturnsForAnyArgs(sanitize);
        public async Task RunAsync(bool isDryRun)
        {
            try
            {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(_package.DisposalToken);

                var toolWindow = (BenchmarkTreeWindow)_package.FindToolWindow(typeof(BenchmarkTreeWindow), 0, false);
                BenchmarkTreeNode selectedNode = toolWindow.SelectedItem;

                var            dte2    = (DTE2)Package.GetGlobalService(typeof(SDTE));
                EnvDTE.Project project = GetProject(dte2, selectedNode.ProjectName);
                if (project == null)
                {
                    return;
                }

                var propertyProvider = await CreateProjectPropertyProviderAsync(project.Name);

                try
                {
                    if (!propertyProvider.IsOptimized)
                    {
                        await UIHelper.ShowErrorAsync(_package,
                                                      "The current build configuration does not have the \"Optimize code\" flag set and is therefore not suitable for running Benchmarks.\r\n\r\nPlease enable the the \"Optimize code\" flag (under Project Properties -> Build) or switch to a non-debug configuration (e.g. 'Release') before running a Benchmark.");

                        return;
                    }
                }
                catch (Exception)
                {
                }

                string configurationName = project.ConfigurationManager.ActiveConfiguration.ConfigurationName;
                dte2.Solution.SolutionBuild.BuildProject(configurationName, project.UniqueName, true);
                if (dte2.Solution.SolutionBuild.LastBuildInfo != 0)
                {
                    return;
                }

                var runParameters = new RunParameters
                {
                    OutputPath   = propertyProvider.OutputPath,
                    ProjectPath  = propertyProvider.ProjectPath,
                    Runtime      = propertyProvider.TargetRuntime,
                    AssemblyPath = propertyProvider.GetOutputFilename(),
                    IsDryRun     = isDryRun,
                    SelectedNode = selectedNode
                };
                BenchmarkRunController runController = new BenchmarkRunController(runParameters, GetOptions());
                await runController.RunAsync();
            }
            catch (Exception ex)
            {
                await UIHelper.ShowErrorAsync(_package, ex.Message);
            }
        }
Ejemplo n.º 16
0
 public void PassesPatcherNameToSanitizer(
     IGroupRun groupRun,
     IPatcherRun patcher,
     FilePath?sourcePath,
     RunParameters runParameters,
     RunArgsConstructor sut)
 {
     sut.GetArgs(groupRun, patcher, sourcePath, runParameters);
     sut.PatcherNameSanitizer.Received(1).Sanitize(patcher.Name);
 }
Ejemplo n.º 17
0
 public async Task RetrievesArgs(
     IGroupRun groupRun,
     IPatcherRun patcher,
     CancellationToken cancellation,
     FilePath?sourcePath,
     RunParameters runParameters,
     RunSynthesisPatcher args,
     RunAPatcher sut)
 {
     sut.GetRunArgs.GetArgs(default !, default !, default, default !)
Ejemplo n.º 18
0
        public void Parse_Timeout()
        {
            RunParameters p = new RunParameters();

            p.Parse(GenerateCommandLineArgs(@"/Timeout:40"));
            Assert.AreEqual(2400000, p.ExecutionTimeout);

            p.Parse(GenerateCommandLineArgs(@"/TIMEOUT:50"));
            Assert.AreEqual(3000000, p.ExecutionTimeout);
        }
Ejemplo n.º 19
0
        public void DefaultValues()
        {
            RunParameters p = new RunParameters();

            Assert.IsInstanceOfType(p.Browser, typeof(IEBrowser));
            Assert.AreEqual(1800000, p.ExecutionTimeout);
            Assert.IsNull(p.WebSitePath);
            Assert.IsNull(p.TagName);
            Assert.IsFalse(p.PrintHelp);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// This method runs a job instance of the given job definition and returns the jobId.
        /// </summary>
        /// <param name='operations'>
        /// The operations group for this extension method.
        /// </param>
        /// <param name='dataServiceName'>
        /// The data service type of the job definition.
        /// </param>
        /// <param name='jobDefinitionName'>
        /// Name of the job definition.
        /// </param>
        /// <param name='runParameters'>
        /// Run time parameters for the job definition.
        /// </param>
        /// <param name='resourceGroupName'>
        /// The Resource Group Name
        /// </param>
        /// <param name='dataManagerName'>
        /// The name of the DataManager Resource within the specified resource group.
        /// DataManager names must be between 3 and 24 characters in length and use any
        /// alphanumeric and underscore only
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>The jobId of the triggered job<returns></returns>
        public static string BeginRunAndGetJobId(this IJobDefinitionsOperations operations, string dataServiceName,
                                                 string jobDefinitionName, RunParameters runParameters, string resourceGroupName, string dataManagerName,
                                                 CancellationToken cancellationToken = default(CancellationToken))
        {
            var result = operations.BeginRunWithHttpMessagesAsync(dataServiceName, jobDefinitionName, runParameters, resourceGroupName,
                                                                  dataManagerName).GetAwaiter().GetResult();
            string jobId = result == null ? String.Empty : result.Response.Headers.Location.AbsolutePath.Split('/').Last()
                           .Split('?').First();

            return(jobId);
        }
Ejemplo n.º 21
0
        public void GetHashCode_Returns_Hash_Code_Based_On_The_Current_Object_Status_When_Using_Default_Object()
        {
            // Arrange
            var runParameters = new RunParameters();

            // Act
            var result = runParameters.GetHashCode();

            // Assert
            Assert.AreEqual(8993, result);
        }
Ejemplo n.º 22
0
        public void Equals_Returns_False_When_Using_Null_Object()
        {
            // Arrange
            var runParameters = new RunParameters();

            // Act
            var result = runParameters.Equals(null);

            // Assert
            Assert.AreEqual(false, result);
        }
Ejemplo n.º 23
0
        public void ToString_Returns_String_Based_On_The_Current_Object_Status_When_Using_Default_Object()
        {
            // Arrange
            var runParameters = new RunParameters();

            // Act
            var result = runParameters.ToString();

            // Assert
            Assert.AreEqual("PboBuilder.RunParameters with values IsOverwriteEnabled:False, PboFormat:Unknown, FolderToPack:, DestinationFilePath:", result);
        }
Ejemplo n.º 24
0
        public void NotEquals_Operator_Returns_True_When_Using_Two_Default_Objects()
        {
            // Arrange
            var runParameters  = new RunParameters();
            var runParameters2 = new RunParameters();

            // Act
            var result = runParameters != runParameters2;

            // Assert
            Assert.AreEqual(false, result);
        }
Ejemplo n.º 25
0
        public void Equals_Returns_True_When_Using_Two_Default_Objects()
        {
            // Arrange
            var runParameters  = new RunParameters();
            var runParameters2 = new RunParameters();

            // Act
            var result = runParameters.Equals(runParameters2);

            // Assert
            Assert.AreEqual(true, result);
        }
Ejemplo n.º 26
0
        public void OutputPathUnderWorkingDirectory(
            IGroupRun groupRun,
            IPatcherRun patcher,
            FilePath?sourcePath,
            RunParameters runParameters,
            RunArgsConstructor sut)
        {
            var result = sut.GetArgs(groupRun, patcher, sourcePath, runParameters);

            result.OutputPath.IsUnderneath(sut.ProfileDirectories.WorkingDirectory)
            .Should().BeTrue();
        }
Ejemplo n.º 27
0
        public void GetHashCode_Returns_Hash_Code_Based_On_The_Current_Object_Status_When_Using_Populated_Object()
        {
            // Arrange
            const string expectedFolderToPack        = "C:\\Some\\Path\\";
            const string expectedDestinationFilePath = "output.pbo";
            var          runParameters = new RunParameters();

            runParameters.PopulateFromCommandLineArguments(new[] { "-o", "-f", "ArmA3", expectedFolderToPack, expectedDestinationFilePath });

            // Act
            var result = runParameters.GetHashCode();

            // Assert
            Assert.AreEqual(1932353595, result);
        }
Ejemplo n.º 28
0
        public async Task <FilePath?> Run(
            IGroupRun groupRun,
            PatcherPrepBundle prepBundle,
            CancellationToken cancellation,
            FilePath?sourcePath,
            RunParameters runParameters)
        {
            try
            {
                // Finish waiting for prep, if it didn't finish
                var prepException = await prepBundle.Prep.ConfigureAwait(false);

                if (prepException != null)
                {
                    return(null);
                }

                var args = GetRunArgs.GetArgs(
                    groupRun,
                    prepBundle.Run,
                    sourcePath,
                    runParameters);

                _fs.Directory.CreateDirectory(args.OutputPath.Directory !);

                _logger.Information("================= Starting Patcher {Patcher} Run =================", prepBundle.Run.Name);

                _reporter.ReportStartingRun(prepBundle.Run.Key, prepBundle.Run.Name);
                await prepBundle.Run.Run(args,
                                         cancel : cancellation).ConfigureAwait(false);

                if (cancellation.IsCancellationRequested)
                {
                    return(null);
                }

                return(FinalizePatcherRun.Finalize(prepBundle.Run, args.OutputPath));
            }
            catch (TaskCanceledException)
            {
                return(null);
            }
            catch (Exception ex)
            {
                _reporter.ReportRunProblem(prepBundle.Run.Key, prepBundle.Run.Name, ex);
                return(null);
            }
        }
Ejemplo n.º 29
0
        public void PopulateFromCommandLineArguments_Should_Populate_Object_When_All_Properties_Specified_Correctly()
        {
            // Arrange
            var          runParameters               = new RunParameters();
            const string expectedFolderToPack        = "C:\\Some\\Path\\";
            const string expectedDestinationFilePath = "output.pbo";

            // Act
            runParameters.PopulateFromCommandLineArguments(new[] { "-o", "-f", "ArmA3", expectedFolderToPack, expectedDestinationFilePath });

            // Assert
            Assert.AreEqual(true, runParameters.IsOverwriteEnabled);
            Assert.AreEqual(PboFormat.Arma3, runParameters.PboFormat);
            Assert.AreEqual(expectedFolderToPack, runParameters.FolderToPack);
            Assert.AreEqual(expectedDestinationFilePath, runParameters.DestinationFilePath);
        }
Ejemplo n.º 30
0
        public async Task NoPatchersShortCircuits(
            CancellationToken cancellation,
            FilePath?sourcePath,
            DirectoryPath outputDir,
            RunParameters runParameters,
            ExecuteRun sut)
        {
            IGroupRun[] groups = Array.Empty <IGroupRun>();
            await sut.Run(
                groups,
                cancellation,
                outputDir,
                runParameters,
                sourcePath);

            sut.EnsureSourcePathExists.DidNotReceiveWithAnyArgs().Ensure(default);
        private static void WarningUpgrade()
        {
            // WARNING: Target file not found in backup.
            var testXmlFile = Path.Combine(Directory.GetCurrentDirectory(), @"Web.config");
            var fileList = new List<TargetFileInfo>
                               	{
                               		new TargetFileInfo(
                               			testXmlFile,
                               			testXmlFile + ".upgrade"
                               			)
                               	};

            var parameters = new RunParameters("TestProduct", new InstallerVersion("1.10.1"), new InstallerVersion(String.Empty),
                fileList);
            parameters.DumpToLog();

            {
                var stageUpgrade = new StageUpgrade(parameters, null);
                var retCode = stageUpgrade.Run();
                Assert.AreEqual(0, retCode);
            }

            // WARNING: Target file not found: NotExist.config
            testXmlFile = @"NotExist.config";
            var upgradeFile = Path.Combine(Directory.GetCurrentDirectory(), @"Config1.xml.upgrade");
            fileList = new List<TargetFileInfo>
                               	{
                               		new TargetFileInfo(
                               			testXmlFile,
                               			upgradeFile
                               			)
                               	};

            parameters = new RunParameters("TestProduct", new InstallerVersion("1.10.1"), new InstallerVersion("1.0.1"), fileList);

            {
                var stageUpgrade = new StageUpgrade(parameters, null);
                var retCode = stageUpgrade.Run();
                Assert.AreEqual(0, retCode);
            }

            // WARNING: Upgrade file info not found.
            fileList = new List<TargetFileInfo>
                               	{
                               		new TargetFileInfo(
                               			testXmlFile,
                               			testXmlFile + ".upgrade"
                               			)
                               	};

            parameters = new RunParameters("TestProduct", new InstallerVersion("1.10.1"), new InstallerVersion("1.0.1"), fileList);

            {
                var stageUpgrade = new StageUpgrade(parameters, null);
                var retCode = stageUpgrade.Run();
                Assert.AreEqual(0, retCode);
            }
        }
Ejemplo n.º 32
0
        private void GoButton_Click(object sender, EventArgs e)
        {
            LogEdit.Clear();

            LogWriteLine("Validating parameters");
            if (!CheckTextBox(InstalledVersionEdit, "Installed Version"))
                return;

            if (!CheckTextBox(InstalledFileEdit, "Installed File"))
                return;

            if (!CheckTextBox(NewVersionEdit, "New Version"))
                return;

            if (!CheckTextBox(NewFileEdit, "New File"))
                return;

            if (!CheckTextBox(UpgradeFileEdit, "Upgrade File"))
                return;

            if (!CheckTextBox(WorkFolderEdit, "Work Folder"))
                return;

            {
                RegistrySettings.SaveValue("InstalledFilePath", InstalledFileEdit.Text);
                RegistrySettings.SaveValue("NewFilePath", NewFileEdit.Text);
                RegistrySettings.SaveValue("UpgradeFilePath", UpgradeFileEdit.Text);
                RegistrySettings.SaveValue("WorkFolder", WorkFolderEdit.Text);

                RegistrySettings.SaveValue("NewVersion", NewVersionEdit.Text);
                RegistrySettings.SaveValue("InstalledVersion", InstalledVersionEdit.Text);
            }

            if(!Directory.Exists(WorkFolderEdit.Text))
            {
                LogWriteLine("Creating work folder");
                Directory.CreateDirectory(WorkFolderEdit.Text);
            }

            var targetFile = Path.Combine(WorkFolderEdit.Text, Path.GetFileName(InstalledFileEdit.Text) + ".UPGRADED");

            LogWriteLine("Copying installed file to target");
            File.Copy(InstalledFileEdit.Text, targetFile, true);
            File.SetAttributes(targetFile, FileAttributes.Normal);

            var fileList = new List<TargetFileInfo>
                               	{
                               		new TargetFileInfo(
                               			targetFile,
                               			UpgradeFileEdit.Text
                               			)
                               	};

            var parameters = new RunParameters(
                "TestProduct",
                new InstallerVersion(NewVersionEdit.Text),
                new InstallerVersion(InstalledVersionEdit.Text),
                fileList);

            {
                LogWriteLine("Processing Backup Stage...");
                var stageBackup = new StageBackup(parameters);
                var retCode = stageBackup.Run();
                if(retCode != 0)
                {
                    LogWriteLine("Backup Stage FAILED: " + retCode);
                    return;
                }
            }

            LogWriteLine("Copying new file to target");
            File.Copy(NewFileEdit.Text, targetFile, true);
            File.SetAttributes(targetFile, FileAttributes.Normal);

            {
                LogWriteLine("Processing Upgrade Stage...");
                var stageUpgrade = new StageUpgrade(parameters, null);
                var retCode = stageUpgrade.Run();
                if (retCode != 0)
                {
                    LogWriteLine("Upgrade Stage FAILED: " + retCode);
                    return;
                }
            }

            LogWriteLine("Successfully completed.");
            LogWriteLine("");
            LogWriteLine("See target file: " + targetFile);
        }
        private static void RunUpgrade(string testXmlFile, string testNewXmlFile, bool expectedSuccessResult = true)
        {
            var fileList = new List<TargetFileInfo>
                               	{
                               		new TargetFileInfo(
                               			testXmlFile,
                               			testXmlFile + ".upgrade"
                               			)
                               	};

            var parameters = new RunParameters("TestProduct", new InstallerVersion("1.10.1"), new InstallerVersion("1.2.0"),
                fileList);
            parameters.DumpToLog();

            {
                var stageBackup = new StageBackup(parameters);
                var retCode = stageBackup.Run();
                Assert.AreEqual(0, retCode);
            }

            File.Copy(testNewXmlFile, testXmlFile, true);

            {
                var definedMsiProperties = new Dictionary<string, string>
                                           	{
                                           		{"ComputerName", "msk-app-0839"}
                                           	};
                var stageUpgrade = new StageUpgrade(parameters, definedMsiProperties);
                var retCode = stageUpgrade.Run();

                if (expectedSuccessResult)
                {
                    Assert.AreEqual(0, retCode);
                }
                else
                {
                    Assert.AreNotEqual(0, retCode);
                }
            }
        }