public async void OpenMutationReport(string path) { try { _loadingDisplayer.ShowLoading($"Loading report at \"{path}\""); var report = await Task.Run(() => JsonConvert.DeserializeObject <TesturaMutationReport>(File.ReadAllText(path))); if (report?.Mutations == null) { CommonDialogDisplayer.ShowErrorDialog( "Unexpected error when loading report", "Report is null (did you try to open an empty file?). Please try to open a different file."); return; } _mutationModuleTabOpener.OpenTestRunTab(report); } catch (Exception ex) { CommonDialogDisplayer.ShowErrorDialog( "Unexpected error when loading report", $"Could not load project at {path}. Please check details for more information.", ex.ToString()); } finally { _loadingDisplayer.HideLoading(); } }
public async void OpenProject(string path) { _loadingDisplayer.ShowLoading($"Opening project at {Path.GetFileName(path)}"); MutationConfig config = null; try { config = await Task.Run(() => _mediator.Send(new OpenProjectCommand(path))); _mutationModuleTabOpener.OpenOverviewTab(config); } catch (ValidationException ex) { CommonDialogDisplayer.ShowErrorDialog("Unexpected error", "Failed to open project.", ex.Message); return; } catch (OpenProjectException ex) { CommonDialogDisplayer.ShowErrorDialog("Unexpected error", "Failed to open project.", ex.InnerException?.ToString()); return; } finally { _loadingDisplayer.HideLoading(); } }
private async void SaveReportAsync() { if (_latestResult == null) { CommonDialogDisplayer.ShowErrorDialog("Nothing so save", "Please run before saving"); } var savePath = _filePicker.PickDirectory(); if (string.IsNullOrEmpty(savePath)) { return; } var trxSavePath = Path.Combine(savePath, "result.trx"); var reports = new List <ReportCreator> { new TrxReportCreator(trxSavePath), new MarkdownReportCreator(Path.ChangeExtension(trxSavePath, ".md")), new TesturaMutationReportCreator(Path.ChangeExtension(trxSavePath, ".Testura.Mutation")), new HtmlOnlyBodyReportCreator(Path.ChangeExtension(trxSavePath, ".html")), new TextSummaryReportCreator(Path.ChangeExtension(trxSavePath, ".txt")) }; await _mediator.Send(new CreateReportCommand(_latestResult, reports, TimeSpan.Zero)); }
private async void CreateDocuments() { _loadingDisplayer.ShowLoading("Creating mutation documents.."); try { var settings = MutationOperatorGridItems.Where(m => m.IsSelected).Select(m => m.MutationOperator); var command = new CreateMutationsCommand(_config); // TODO: settings.Select(MutationOperatorFactory.GetMutationOperator).ToList() var mutationDocuments = await Task.Run(() => _mediator.Send(command)); var fileNames = mutationDocuments.Select(r => r.FileName).Distinct(); foreach (var fileName in fileNames) { Documents.Add(new DocumentRowModel { MFile = new FileMutationsModel(fileName, mutationDocuments.Where(m => m.FileName == fileName).ToList()) }); } } catch (MutationDocumentException ex) { CommonDialogDisplayer.ShowErrorDialog("Failed to create mutations", ex.Message, ex.InnerException?.Message); } finally { _loadingDisplayer.HideLoading(); } }
private async Task GoNext() { var result = CommonDialogDisplayer.ShowInfoDialog("We will now clone and build the project. Are you sure? "); if (!result) { return; } try { _loadingDisplayer.ShowLoading("Cloning project and building project.."); await _gitCloner.CloneSolutionAsync(RepositoryUrl, BranchName, Username, Password, LocalPath); _loadingDisplayer.ShowLoading("Looking for solution.."); var solutionPath = _solutionFinder.FindSolution(LocalPath); if (solutionPath == null) { throw new Exception($"Could not find any solution file in the {LocalPath} directory or subdirectories."); } var gitInfo = new GitInfo { RepositoryUrl = RepositoryUrl, Branch = BranchName, LocalPath = LocalPath, Username = Username, Password = Password }; _loadingDisplayer.HideLoading(); _startModuleTabOpener.OpenNewProjectTab(gitInfo, solutionPath); } catch (Exception ex) { _loadingDisplayer.HideLoading(); CommonDialogDisplayer.ShowErrorDialog("Error when cloning project", ex.Message, ex.ToString()); } }