public void SetUp()
        {
            _job = new Job(new JobInfo(), new ConversionProfile(), new JobTranslations(), new Accounts());
            _job.OutputFilenameTemplate = "MayNotStartWithTempfolder.pdf";
            _job.OutputFiles.Add("NotEmpty.pdf");
            _storedHistory = new List <HistoricJob>();

            _jobHistoryStorage = Substitute.For <IJobHistoryStorage>();
            for (var i = 0; i < _capacity; i++)
            {
                _storedHistory.Add(new HistoricJob(_job));
            }
            _jobHistoryStorage.Load().Returns(_storedHistory);

            var settingsProvider = Substitute.For <ISettingsProvider>();

            _settings = new PdfCreatorSettings(null);
            _settings.ApplicationSettings.JobHistory.Enabled  = true;
            _settings.ApplicationSettings.JobHistory.Capacity = _capacity;
            settingsProvider.Settings.Returns(_settings);

            _tempFolderProvider = Substitute.For <ITempFolderProvider>();
            _tempFolderProvider.TempFolder.Returns(TempFolder);

            _file = Substitute.For <IFile>();
            _file.Exists(Arg.Any <string>()).Returns(true);

            _jobHistoryManager = new JobHistoryManager(settingsProvider, _jobHistoryStorage, _tempFolderProvider, _file);
        }
        public async Task Load()
        {
            lock (this)
            {
                History = _jobHistoryStorage.Load();
            }

            await Refresh();

            UpdateCapacity();
        }
        public async Task Load()
        {
            if (!HistoryEnabled)
            {
                return;
            }

            lock (this)
            {
                History = _jobHistoryStorage.Load();
            }

            await Refresh();

            UpdateCapacity();
        }
Beispiel #4
0
        public void SetUp()
        {
            _job = new Job(new JobInfo(), new ConversionProfile(), new JobTranslations(), new Accounts());
            _job.OutputFilenameTemplate = "MayNotStartWithTempfolder.pdf";
            _job.OutputFiles.Add("NotEmpty.pdf");
            _storedHistoryFullCapacity = new List <HistoricJob>();

            _jobHistoryStorage         = Substitute.For <IJobHistoryStorage>();
            _storedHistoryFullCapacity = new List <HistoricJob>();
            var hjPdf         = new HistoricFile(@"X:\Foldername\PeeDeeEff.pdf", "PeeDeeEff.pdf", @"X:\Foldername\", "ABC123");
            var historicFiles = new List <HistoricFile> {
                hjPdf
            };

            for (int i = 0; i < _capacity; i++)
            {
                _storedHistoryFullCapacity.Add(new HistoricJob(historicFiles, OutputFormat.Pdf, DateTime.Now, new Metadata(), 23, false));
            }
            _jobHistoryStorage.Load().Returns(_storedHistoryFullCapacity);

            var settingsProvider = Substitute.For <ISettingsProvider>();

            _settings = new PdfCreatorSettings(null);
            _settings.ApplicationSettings.JobHistory.Enabled  = true;
            _settings.ApplicationSettings.JobHistory.Capacity = _capacity;
            settingsProvider.Settings.Returns(_settings);

            _tempFolderProvider = Substitute.For <ITempFolderProvider>();
            _tempFolderProvider.TempFolder.Returns(TempFolder);

            _file = Substitute.For <IFile>();
            _file.Exists(Arg.Any <string>()).Returns(true);

            _hashUtil = Substitute.For <IHashUtil>();

            _jobHistoryManager = new JobHistoryManager(settingsProvider, _jobHistoryStorage, _tempFolderProvider, _file, _hashUtil);
        }