Ejemplo n.º 1
0
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            TestHelper = container.GetInstance <TestHelper>();
            TestHelper.InitTempFolder("PDFProcessing_IText_Signing");

            TestHelper.GenerateGsJob_WithSetOutput(TestFile.ThreePDFCreatorTestpagesPDF);
            TestHelper.Job.Passwords.PdfSignaturePassword = "******";
            TestHelper.Job.Profile.PdfSettings.Signature.CertificateFile = TestHelper.GenerateTestFile(TestFile.CertificationFileP12);
            TestHelper.Job.Profile.PdfSettings.Signature.Enabled         = true;

            TestHelper.Job.Profile.PdfSettings.Signature.AllowMultiSigning          = true;
            TestHelper.Job.Profile.PdfSettings.Signature.DisplaySignatureInDocument = true;
            TestHelper.Job.Profile.PdfSettings.Signature.SignaturePage       = SignaturePage.FirstPage;
            TestHelper.Job.Profile.PdfSettings.Signature.SignatureCustomPage = 1;
            TestHelper.Job.Profile.PdfSettings.Signature.LeftX         = 50;
            TestHelper.Job.Profile.PdfSettings.Signature.LeftY         = 50;
            TestHelper.Job.Profile.PdfSettings.Signature.RightX        = 300;
            TestHelper.Job.Profile.PdfSettings.Signature.RightY        = 150;
            TestHelper.Job.Profile.PdfSettings.Signature.SignContact   = "Mr.Test";
            TestHelper.Job.Profile.PdfSettings.Signature.SignLocation  = "Testland";
            TestHelper.Job.Profile.PdfSettings.Signature.SignReason    = "The Reason is Testing";
            TestHelper.Job.Profile.PdfSettings.Signature.TimeServerUrl = "http://timestamp.globalsign.com/scripts/timestamp.dll";

            PDFProcessor = BuildPdfProcessor();
        }
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container = bootstrapper.ConfigureContainer();
            container.Options.AllowOverridingRegistrations = true;

            _workflowFactory = container.GetInstance<IWorkflowFactory>();
            _jobBuilder = container.GetInstance<IJobBuilder>();

            _interactiveProfile = new ConversionProfile();
            _interactiveProfile.Name = InteractivePrinterName;
            _interactiveProfile.Guid = InteractiveProfileGuid;
            _interactiveProfile.AutoSave.Enabled = false;
            _interactiveProfileMapping = new PrinterMapping(InteractivePrinterName, InteractiveProfileGuid);

            _autosaveProfile = new ConversionProfile();
            _autosaveProfile.Name = AutosaveProfileName;
            _autosaveProfile.Guid = AutosaveProfileGuid;
            _autosaveProfile.AutoSave.Enabled = true;
            _autosaveProfileMapping = new PrinterMapping(AutosavePrinterName, AutosaveProfileGuid);

            _th = container.GetInstance<TestHelper>();
            _th.InitTempFolder("ConversionWorklowTest");
            _th.GenerateGsJob(PSfiles.ThreePDFCreatorTestpages, OutputFormat.Pdf);
            _settings = new PdfCreatorSettings(null);
        }
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            //override PasswordProvider, because tests write to job.passwords directly and the provider would replace those values with empty strings from the profile
            container.Options.AllowOverridingRegistrations = true;
            RegisterPdfProcessor(container);

            _pdfProcessor = container.GetInstance <IPdfProcessor>();

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("PdfProcessing PerformanceTest");

            var timeServerAccount = new TimeServerAccount();

            timeServerAccount.AccountId = "TestTimerserverID";
            var accounts = new Accounts();

            accounts.TimeServerAccounts.Add(timeServerAccount);
            _th.SetAccounts(accounts);

            _th.Profile.PdfSettings.Signature.TimeServerAccountId = timeServerAccount.AccountId;

            _th.Profile.PdfSettings.Signature.CertificateFile = _th.GenerateTestFile(TestFile.CertificationFileP12);
            _th.Profile.BackgroundPage.File = _th.GenerateTestFile(TestFile.Background3PagesPDF);
        }
Ejemplo n.º 4
0
        public void SetUp()
        {
            var fixture = new Fixture();

            _userName     = fixture.Create <string>();
            _smtpPassword = fixture.Create <string>();

            _mailSignatureHelper = Substitute.For <IMailSignatureHelper>();
            _mailSignatureHelper.ComposeMailSignature().Returns("");

            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("SmtpEmailTest");

            _tokenReplacer = new TokenReplacer();
            _tokenReplacer.AddStringToken("ReplaceThis", "Replaced");

            var serverIp = IPAddress.Loopback;

            _smtpPort   = FindFreeTcpPort();
            _mailServer = serverIp.ToString();
            _smtpServer = new SmtpServerForUnitTest(serverIp, _smtpPort, new[] { new NetworkCredential(_userName, _smtpPassword) });
            _smtpServer.Start();
        }
Ejemplo n.º 5
0
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("DevicesGeneralTests");

            _singleTempOutputfile    = new[] { @"output1.pdf" };
            _multipleTempOutputFiles = new[] { @"output1.png", @"output2.png", @"output3.png" };
            _multipleTempOutputFilesWithTwoDigits = new[]
            {
                @"output1.png", @"output2.png", @"output3.png",
                @"output4.png", @"output5.png", @"output6.png",
                @"output7.png", @"output8.png", @"output9.png",
                @"output10.png"
            };

            _countRetypeOutputFilename = 0;
            _cancelRetypeFilename      = false;

            _pathUtil = new PathUtil(new PathWrap(), new DirectoryWrap());

            _queryRetypeFileName = Substitute.For <IRetypeFileNameQuery>();
            _queryRetypeFileName.RetypeFileName(Arg.Any <string>(), Arg.Any <OutputFormat>()).Returns(RetypeOutputFilename);
        }
Ejemplo n.º 6
0
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("ScriptActionTest");

            _scriptFile = _th.GenerateTestFile(TestFile.ScriptCopyFilesToDirectoryCMD);

            /*
             * Script:
             * rem Script copies multiple files into the directory given as first parameter
             * if %1 == """" goto end
             * if %2 == """" goto end
             * set targetDir=%1
             * md %targetDir%
             * :copy
             * if %2 == """" goto end
             * copy %2 %targetDir%
             * shift
             * goto copy
             * :end
             */
        }
Ejemplo n.º 7
0
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("PngTest");
        }
Ejemplo n.º 8
0
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("PDFProcessing basic test");
            PdfProcessor = new ITextPdfProcessor(new FileWrap(), new DefaultProcessingPasswordsProvider());
        }
Ejemplo n.º 9
0
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            container.Options.AllowOverridingRegistrations = true;
            container.Register(() => Substitute.For <IJobCleanUp>());
            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("UniqueFilenameTest");
        }
Ejemplo n.º 10
0
        public void SetUp()
        {
            _pdfProcessor = BuildPdfProcessor();

            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder($"PDFProcessing_{_pdfProcessor.GetType().Name}_Combined");
        }
Ejemplo n.º 11
0
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("CoverAndAttachmentTest");

            _coverFile      = _th.GenerateTestFile(TestFile.Cover2PagesPDF);
            _attachmentFile = _th.GenerateTestFile(TestFile.Attachment3PagesPDF);
        }
Ejemplo n.º 12
0
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("AutoSaveTest");
            _th.Profile.ShowProgress = false;

            _factory = container.GetInstance <ConversionWorkflowTestFactory>();
        }
Ejemplo n.º 13
0
        private void SetUpTestWithRegularTempFolder()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            container.Options.AllowOverridingRegistrations = true;
            container.Register <ITempFolderProvider, TempFolderProvider>();
            container.Options.AllowOverridingRegistrations = false;

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("SpecialCharactersTest");
        }
Ejemplo n.º 14
0
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _dropboxService             = new DropboxService();
            _dropboxService.AccessToken = DROPBOX_ACCESSTOKEN;

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder(DROPBOX_FOLDER);
            _addedFiles    = new List <string>();
            _dropboxClient = new DropboxClient(DROPBOX_ACCESSTOKEN);
        }
Ejemplo n.º 15
0
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            //override PasswordProvider, because tests write to job.passwords directly and the provider would replace those values with empty strings from the profile
            container.Options.AllowOverridingRegistrations = true;
            container.Register(() => Substitute.For <IProcessingPasswordsProvider>());

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("SigningTest");
            _th.Profile.PdfSettings.Signature.CertificateFile = _th.GenerateTestFile(TestFile.CertificationFileP12);
        }
Ejemplo n.º 16
0
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("PDFProcessing_IText_Encryption");

            _th.GenerateGsJob_WithSetOutput(TestFile.PDFCreatorTestpagePDF);
            _th.Job.Passwords.PdfOwnerPassword = "******";
            _th.Job.Passwords.PdfUserPassword  = "******";

            _pdfProcessor = BuildPdfProcessor();
        }
Ejemplo n.º 17
0
        public void SetUp()
        {
            _pdfProcessor = BuildPdfProcessor();

            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            container.Options.AllowOverridingRegistrations = true;
            container.Register(() => _pdfProcessor);
            container.Options.AllowOverridingRegistrations = false;

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder($"PDFProcessing_{_pdfProcessor.GetType().Name}_PDFA");
        }
Ejemplo n.º 18
0
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("PDFProcessing Signing Test");

            _th.GenerateGsJob_WithSettedOutput(TestFile.ThreePDFCreatorTestpagesPDF);
            _th.Job.Passwords.PdfSignaturePassword = "******";
            _th.Job.Profile.PdfSettings.Signature.CertificateFile = _th.GenerateTestFile(TestFile.CertificationFileP12);
            _th.Job.Profile.PdfSettings.Signature.Enabled         = true;

            PdfProcessor = new ITextPdfProcessor(new FileWrap(), new DefaultProcessingPasswordsProvider());
        }
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("PDFProcessing encryption test");

            _testFile  = _th.GenerateTestFile(TestFile.PDFCreatorTestpagePDF);
            _passwords = new JobPasswords();
            _passwords.PdfOwnerPassword = "******";
            _passwords.PdfUserPassword  = "******";

            PdfProcessor = new ITextPdfProcessor(new FileWrap(), new DefaultProcessingPasswordsProvider());
        }
Ejemplo n.º 20
0
        private void InitializeTest(TestFile tf)
        {
            _pdfProcessor = BuildPdfProcessor();

            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder($"PDFProcessing_{_pdfProcessor.GetType().Name}_XMPMetadata");
            _th.GenerateGsJob_WithSetOutput(tf);

            //Settings of the set outputfile
            _th.Job.JobInfo.Metadata.Title    = "Test Title";
            _th.Job.JobInfo.Metadata.Subject  = "Test Subject";
            _th.Job.JobInfo.Metadata.Keywords = "Test Keywords";
            _th.Job.JobInfo.Metadata.Author   = "Test Author";
        }
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("PsFileHelperTest");
            _testSpoolfolder = Path.Combine(_th.TmpTestFolder, "TestSpoolFolder");
            _th.GenerateGsJob(PSfiles.PDFCreatorTestpage, OutputFormat.Pdf);
            _psTestFile = _th.TmpPsFiles[0];

            var settingsProvider = Substitute.For <ISettingsProvider>();
            var settings         = new PdfCreatorSettings(Substitute.For <IStorage>());

            settingsProvider.Settings.Returns(settings);

            _directConversionBase = new PsDirectConversion(settingsProvider, new JobInfoManager(null));
        }
Ejemplo n.º 22
0
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("PDFProcessing XMP metadata update test");

            _th.GenerateGsJob_WithSettedOutput(TestFile.PDFCreatorTestpagePdfA);

            //Settings of the previously created outputfile
            _th.Job.JobInfo.Metadata.Title    = "Test Title";
            _th.Job.JobInfo.Metadata.Subject  = "Test Subject";
            _th.Job.JobInfo.Metadata.Keywords = "Test Keywords";
            _th.Job.JobInfo.Metadata.Author   = "Test Author";

            PDFProcessor = new ITextPdfProcessor(new FileWrap(), new DefaultProcessingPasswordsProvider());
        }
Ejemplo n.º 23
0
        public async Task GetOrder_ReturnsStored()
        {
            //Arrange
            var(client, dbContext) = IntegrationTestBootstrapper.Build();
            var order = new BreadOrder(Guid.NewGuid(), "someone", "here", new() { new BreadOrderLine(Guid.NewGuid(), 12345, "Must be good", new BreadPreferences(true, false)) });

            dbContext.Orders.Add(order);
            dbContext.SaveChanges();

            //Act
            var result = await client.GetAsync($"/order/{order.Id}");

            //Assert
            result.EnsureSuccessStatusCode();
            var returnedOrder = JObject.Parse(await result.Content.ReadAsStringAsync());

            returnedOrder["orderLines"].Last()["input"].Should().NotBeNull();
        }
Ejemplo n.º 24
0
        public void SetUp()
        {
            PdfProcessor = BuildPdfProcessor();

            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _accounts          = new Accounts();
            _timeServerAccount = new TimeServerAccount();
            _accounts.TimeServerAccounts.Add(_timeServerAccount);

            TestHelper = container.GetInstance <TestHelper>();
            TestHelper.InitTempFolder($"PDFProcessing_{PdfProcessor.GetType().Name}_Signing");

            TestHelper.GenerateGsJob_WithSetOutput(TestFile.ThreePDFCreatorTestpagesPDF);
            TestHelper.Job.Profile.PdfSettings.Signature.AllowMultiSigning = true;

            ApplySignatureSettings();
        }
Ejemplo n.º 25
0
        public void SetupSettings()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _jobBuilder = container.GetInstance <IJobBuilder>();

            var ini = new IniStorage("");

            _testHelper = container.GetInstance <TestHelper>();
            _testHelper.InitTempFolder("MappingTest");

            _settings = new PdfCreatorSettings();
            _settings.ConversionProfiles.Add(new ConversionProfile {
                Guid = "Profile0", Name = "Profile0"
            });
            _settings.ConversionProfiles.Add(new ConversionProfile {
                Guid = "Profile1", Name = "Profile1"
            });

            _testHelper.GenerateGsJob(PSfiles.EmptyPage, OutputFormat.Pdf);
        }
Ejemplo n.º 26
0
        public void SetUp()
        {
            _ftpTestAccount           = new FtpAccount();
            _ftpTestAccount.AccountId = "FtpTestAccountID";
            _ftpTestAccount.Server    = ParameterHelper.GetPassword("ftp_server");
            _ftpTestAccount.UserName  = ParameterHelper.GetPassword("ftp_user");
            _ftpTestAccount.Password  = ParameterHelper.GetPassword("ftp_password");

            var bootstrapper = new IntegrationTestBootstrapper();

            _container = bootstrapper.ConfigureContainer();
            _container.Options.AllowOverridingRegistrations = true;
            _container.Options.AllowOverridingRegistrations = false;

            _th = _container.GetInstance <TestHelper>();
            _th.InitTempFolder("FtpTest");

            _th.Profile.Ftp.Enabled   = true;
            _th.Profile.Ftp.AccountId = _ftpTestAccount.AccountId;

            _accounts = new Accounts();
            _accounts.FtpAccounts.Add(_ftpTestAccount);
        }
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("PDFProcessing combined test");
            _th.GenerateGsJob_WithSettedOutput(TestFile.PDFCreatorTestpagePdfA);

            _th.Job.Profile.BackgroundPage.File = _th.GenerateTestFile(TestFile.Background3PagesPDF);
            _th.Job.Profile.PdfSettings.Signature.CertificateFile = _th.GenerateTestFile(TestFile.CertificationFileP12);

            _th.Job.Passwords.PdfUserPassword      = "******";
            _th.Job.Passwords.PdfOwnerPassword     = "******";
            _th.Job.Passwords.PdfSignaturePassword = "******";

            _th.Job.JobInfo.Metadata.Title    = "Test Title";
            _th.Job.JobInfo.Metadata.Subject  = "Test Subject";
            _th.Job.JobInfo.Metadata.Keywords = "Test Keywords";
            _th.Job.JobInfo.Metadata.Author   = "Test Author";

            PdfProcessor = new ITextPdfProcessor(new FileWrap(), new DefaultProcessingPasswordsProvider());
        }
Ejemplo n.º 28
0
        public void SetUp()
        {
            _account = new HttpAccount();

            _account.Url = GetUrl();
            _account.IsBasicAuthentication = false;
            _account.AccountId             = "1";

            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("HttpRequestTest");

            _th.GenerateGsJob_WithSetOutput(TestFile.PDFCreatorTestpage_GS9_19_PDF);

            _th.Job.Accounts.HttpAccounts.Add(_account);

            _th.Job.Profile.HttpSettings.Enabled   = true;
            _th.Job.Profile.HttpSettings.AccountId = _account.AccountId;

            _httpAction = new HttpAction();
        }
Ejemplo n.º 29
0
        public async Task UpdateOrderAddProducts_StoresNew()
        {
            //Arrange
            var(client, dbContext) = IntegrationTestBootstrapper.Build();
            var createdResponse = await client.PostAsync("/order", new StringContent("", Encoding.UTF8, MediaTypeNames.Application.Json));

            string json = await createdResponse.Content.ReadAsStringAsync();

            var adjustedOrder = JObject.Parse(json);
            var newOrderLine  = JObject.Parse(@"{
                'id': 'd21b08e4-16f4-4ae9-83db-b1fc7a10c4df',
                'goodsType': 0,
                'sKU': 14713499,
                'remark': 'bring it home',
                'input': {
                    'wheat': true,
                    'seeds': false
                }
            }");
            var orderLines    = (JArray)adjustedOrder["orderLines"];

            orderLines.Add(newOrderLine);

            //Act
            var result = await client.PutAsync($"/order/{(string)adjustedOrder["id"]}", new StringContent(adjustedOrder.ToString(), Encoding.UTF8, MediaTypeNames.Application.Json));

            //Assert
            result.EnsureSuccessStatusCode();
            var returnedOrder = JObject.Parse(await result.Content.ReadAsStringAsync());

            returnedOrder["orderLines"].Last()["input"].Should().NotBeNull();
            var order = dbContext.Orders.Include(o => o.OrderLines).Single();

            order.OrderLines.Should().HaveCount(orderLines.Count);
            order.OrderLines.Last().As <BreadOrderLine>().Input.Should().NotBeNull();
        }
Ejemplo n.º 30
0
        public void SetUp()
        {
            var bootstrapper = new IntegrationTestBootstrapper();
            var container    = bootstrapper.ConfigureContainer();

            _th = container.GetInstance <TestHelper>();
            _th.InitTempFolder("PDFProcessing_IText_Basic");

            var passwordsProvider = Substitute.For <IProcessingPasswordsProvider>();

            passwordsProvider.When(x => x.SetEncryptionPasswords(Arg.Any <Job>())).Do(x =>
            {
                var job = x[0] as Job;
                job.Passwords.PdfOwnerPassword = OwnerPassword;
                job.Passwords.PdfUserPassword  = UserPassword;
            });
            passwordsProvider.When(x => x.SetSignaturePassword(Arg.Any <Job>())).Do(x =>
            {
                var job = x[0] as Job;
                job.Passwords.PdfSignaturePassword = SignaturePassword;
            });

            _pdfProcessor = BuildPdfProcessor(passwordsProvider);
        }