コード例 #1
0
#pragma warning restore CS0067

        public DesignTimeJobHistoryActiveRecord()
        {
            var metaData = new Metadata
            {
                Author   = "Arthur Author",
                Title    = "Creative Title",
                Subject  = "Even more creative Subject",
                Keywords = "Keyword1 Keyword2 Keyword7"
            };

            var hjPdf         = new HistoricFile(@"X:\Foldername\PeeDeeEff.pdf", "PeeDeeEff.pdf", @"X:\Foldername\", "ABC123");
            var historicFiles = new List <HistoricFile> {
                hjPdf
            };
            var historicJob1 = new HistoricJob(historicFiles, OutputFormat.Pdf, DateTime.Now, metaData, 23, false);

            var hjJpg1 = new HistoricFile(@"X:\Foldername\JotPeeGee1.jpg", "JotPeeGee1.jpg", @"X:\Foldername\", "DEF456");
            var hjJpg3 = new HistoricFile(@"X:\Foldername\JotPeeGee3.jpg", "JotPeeGee3.jpg", @"X:\Foldername\", "GHI789");

            historicFiles = new List <HistoricFile> {
                hjJpg1, hjJpg3
            };
            var historicJob2 = new HistoricJob(historicFiles, OutputFormat.Pdf, DateTime.Now, metaData, 3, true);

            History = new List <HistoricJob> {
                historicJob1, historicJob2
            };
        }
コード例 #2
0
        public void SendValidHistoricJobIntoCommand_ExecuteCommand_RunsAction()
        {
            var command       = build();
            var historicFiles = new List <HistoricFile>
            {
                new HistoricFile("C:\\kartoffel.pdf", "kartoffel.pdf", "C:\\", "wtf1"),
                new HistoricFile("C:\\salat.pdf", "salat", "C:\\", "wtf2"),
                new HistoricFile("C:\\Marvin.pdf", "Marvin.pdf", "C:\\", "wtf3")
            };

            var historicJob = new HistoricJob(historicFiles, OutputFormat.Pdf, DateTime.Now, new Metadata(), 3, false);

            var equivalentList = new List <string>();

            foreach (var historicFile in historicJob.HistoricFiles)
            {
                equivalentList.Add(historicFile.Path);
            }

            command.Execute(historicJob);
            _emailClientAction.
            Received(1).
            Process("",
                    "",
                    false,
                    true,
                    "",
                    "",
                    "",
                    "",
                    true,
                    Arg.Is <IEnumerable <string> >(enumerable => ListsAreEqual(equivalentList, enumerable)));
        }
コード例 #3
0
        public void Remove_HistoryDoesNotContainJob_RemoveGetsIgnored()
        {
            _jobHistoryManager.Load(); //Adds jobs to history
            var unavailableJob = new HistoricJob(_job);

            _jobHistoryManager.Remove(unavailableJob);

            Assert.AreEqual(_capacity, _jobHistoryManager.History.Count);
            Assert.IsFalse(_jobHistoryManager.History.Contains(unavailableJob));
        }
コード例 #4
0
        public void Load_RemovesDeletedJobsFromHistory()
        {
            var deletedFile = "deleted";

            _job.OutputFiles[0] = deletedFile;
            _file.Exists(deletedFile).Returns(false);
            var deletedHistoricJob = new HistoricJob(_job);

            _storedHistory.Add(deletedHistoricJob);

            _jobHistoryManager.Load(); //Adds jobs to history

            Assert.False(_jobHistoryManager.History.Contains(deletedHistoricJob), "Did not remvoe deleted file from history");
        }
コード例 #5
0
        public void SendValidPDFJobHistory_CallExecute_CallOpenOutputFile()
        {
            var command       = BuildCommand();
            var historicFiles = new List <HistoricFile>
            {
                new HistoricFile("C:\\kartoffel.pdf", "kartoffel.pdf", "C:\\", "wtf1"),
                new HistoricFile("C:\\salat.pdf", "salat", "C:\\", "wtf2"),
                new HistoricFile("C:\\Marvin.pdf", "Marvin.pdf", "C:\\", "wtf3")
            };

            var historicJob = new HistoricJob(historicFiles, OutputFormat.Pdf, DateTime.Now, new Metadata(), 3, false);

            var defaultViewerByOutputFormat = _settingsProvider.Settings.GetDefaultViewerByOutputFormat(OutputFormat.Pdf);

            defaultViewerByOutputFormat.IsActive = true;

            _fileAssoc.HasOpen(Arg.Any <string>()).Returns(false);

            _defaultViewerAction.OpenOutputFile(historicFiles.First().Path).Returns(new ActionResult());
            command.Execute(historicJob);

            _defaultViewerAction.Received(1).OpenOutputFile(historicFiles.First().Path);
        }
コード例 #6
0
 public void Remove(HistoricJob historicJob)
 {
     throw new NotImplementedException();
 }
コード例 #7
0
        public void HistoricJob_CanBeInitializedByJob()
        {
            var historicJob = new HistoricJob(_job);

            Assert.IsNotNull(historicJob);
        }