Beispiel #1
0
        public void SetUp()
        {
            var dependencies = ComTestHelper.ModifyAndBuildComDependencies();

            LoggingHelper.InitConsoleLogger("PDFCreatorTest", LoggingLevel.Off);

            _queue = new Queue();
            _queue.Initialize();

            var assembly       = GetType().Assembly;
            var assemblyHelper = new AssemblyHelper(assembly);

            var translationHelper = new TranslationHelper(new DefaultSettingsProvider(), assemblyHelper, new TranslationFactory(), null);

            translationHelper.InitTranslator("None");

            var folderProvider = new FolderProvider(new PrinterPortReader(new RegistryWrap(), new PathWrapSafe()), new PathWrap());

            _testPageHelper = new TestPageHelper(new VersionHelper(assembly), new OsHelper(), folderProvider,
                                                 dependencies.QueueAdapter.JobInfoQueue, new JobInfoManager(new LocalTitleReplacerProvider(new List <TitleReplacement>())), new ApplicationNameProvider("FREE"));

            CreateTestPages(1);

            _printJob     = _queue.NextJob;
            _printJobInfo = _printJob.PrintJobInfo;
        }
Beispiel #2
0
        public void SetUp()
        {
            var dependencies = ComTestHelper.ModifyAndBuildComDependencies();

            LoggingHelper.InitConsoleLogger("PDFCreatorTest", LoggingLevel.Off);

            var installationPathProvider = new InstallationPathProvider(@"Software\pdfforge\PDFCreator\Settings", @"Software\pdfforge\PDFCreator", "{00000000-0000-0000-0000-000000000000}");

            var settingsProvider = new DefaultSettingsProvider();

            var translationHelper = new TranslationHelper(settingsProvider, new AssemblyHelper(GetType().Assembly), new TranslationFactory(), null);

            translationHelper.InitTranslator("None");

            var settingsLoader = new SettingsLoader(translationHelper, Substitute.For <ISettingsMover>(), installationPathProvider, Substitute.For <IPrinterHelper>());

            var settingsManager = new SettingsManager(settingsProvider, settingsLoader, installationPathProvider);

            settingsManager.LoadAllSettings();

            var folderProvider = new FolderProvider(new PrinterPortReader(new RegistryWrap(), new PathWrapSafe()), new PathWrap());

            _queue = new Queue();
            _queue.Initialize();

            _testPageHelper = new TestPageHelper(new VersionHelper(GetType().Assembly), new OsHelper(), folderProvider,
                                                 dependencies.QueueAdapter.JobInfoQueue, new JobInfoManager(new LocalTitleReplacerProvider(new List <TitleReplacement>())), new ApplicationNameProvider("FREE"));
        }
Beispiel #3
0
        public void WithPdfFileAsArgument_AddItToQueue()
        {
            var dependencies = ComTestHelper.ModifyAndBuildComDependencies();

            _th.InitTempFolder("PDFTest");
            var path          = _th.GenerateTestFile(TestFile.PDFCreatorTestpage_GS9_19_PDF); //The pdf file content is irrelevant for this test.
            var queueInstance = dependencies.QueueAdapter.JobInfoQueue;
            var jobNumber     = queueInstance.Count;

            _pdfCreatorObj.AddFileToQueue(path);

            Assert.AreEqual(++jobNumber, queueInstance.Count);
            queueInstance.Remove(queueInstance.JobInfos[--jobNumber], true);
            _th.CleanUp();
        }
Beispiel #4
0
        public void SetUp()
        {
            var dependencies = ComTestHelper.ModifyAndBuildComDependencies();

            LoggingHelper.InitConsoleLogger("PDFCreatorTest", LoggingLevel.Off);

            var installationPathProvider = new InstallationPathProvider(@"Software\pdfforge\PDFCreator\Settings", @"Software\pdfforge\PDFCreator", "{00000000-0000-0000-0000-000000000000}", RegistryHive.CurrentUser);

            var settingsProvider = new DefaultSettingsProvider();

            var translationHelper = new TranslationHelper(settingsProvider, new AssemblyHelper(GetType().Assembly), new TranslationFactory(), null);

            translationHelper.InitTranslator("None");

            var defaultSettingsBuilder = Substitute.For <IDefaultSettingsBuilder>();

            defaultSettingsBuilder.
            CreateEmptySettings().
            Returns(new PdfCreatorSettings());

            defaultSettingsBuilder.
            CreateDefaultSettings(Arg.Any <string>(), Arg.Any <string>()).
            Returns(new PdfCreatorSettings());

            defaultSettingsBuilder.
            CreateDefaultProfile().
            Returns(new ConversionProfile());

            var migrationStorageFactory = Substitute.For <IMigrationStorageFactory>();
            var settingsLoader          = new SettingsLoader(translationHelper, Substitute.For <ISettingsMover>(), installationPathProvider, Substitute.For <IPrinterHelper>(), new EditionHelper(false, false), defaultSettingsBuilder, migrationStorageFactory);

            var settingsManager = new SettingsManager(settingsProvider, settingsLoader, installationPathProvider, new VersionHelper(Assembly.GetExecutingAssembly()), new List <IFirstTimeCommand>());

            settingsManager.LoadAllSettings();

            var folderProvider = new FolderProvider(new PrinterPortReader(new RegistryWrap()), new PathWrap());

            _queue = new Queue();
            _queue.Initialize();

            var testPageCreator = new TestPageCreator(new ApplicationNameProvider("FREE"), new VersionHelper(new Version(1, 0, 0, 0)), new OsHelper());

            _testPageHelper = new TestPageHelper(folderProvider, dependencies.QueueAdapter.JobInfoQueue, new JobInfoManager(new LocalTitleReplacerProvider(new List <TitleReplacement>()), null), testPageCreator);
        }
Beispiel #5
0
 public void CleanDependencies()
 {
     ComDependencyBuilder.ResetDependencies();
     ComTestHelper.ModifyAndBuildComDependencies();
 }