public override void Execute(object obj) { var path = GetPaths(obj).FirstOrDefault(); if (!path.EndsWith(".pdf", StringComparison.InvariantCultureIgnoreCase)) { HandleActionResult(Action.OpenOutputFile(path)); } else { if (FileAssoc.HasOpen(".pdf") || SettingsProvider.Settings.ApplicationSettings.GetDefaultViewerByOutputFormat(OutputFormat.Pdf).IsActive) { HandleActionResult(Action.OpenOutputFile(path)); } else { CommandLocator.GetCommand <QuickActionOpenWithPdfArchitectCommand>().Execute(obj); } } }
public void SendValidPDFJob_CallExecute_CallOpenOutputFile() { var command = BuildCommand(); var defaultViewerByOutputFormat = _settingsProvider.Settings.GetDefaultViewerByOutputFormat(OutputFormat.Pdf); defaultViewerByOutputFormat.IsActive = true; _job.OutputFiles.Add(_fileList.First()); _fileAssoc.HasOpen(Arg.Any <string>()).Returns(false); _defaultViewerAction.OpenOutputFile(_job.OutputFiles.First()).Returns(new ActionResult()); command.Execute(_job); _defaultViewerAction.Received(1).OpenOutputFile(_job.OutputFiles.First()); }