예제 #1
0
        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);
                }
            }
        }
예제 #2
0
        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());
        }