Exemplo n.º 1
0
        public void CreatePurchaseOrderPdfTest()
        {
            var testUser    = GetTestUser();
            var testCompany = GetTestCompanyAU();

            // Find a random purchase order header
            var poh = db.FindPurchaseOrderHeaders(testCompany.Id)
                      .Skip(RandomInt(0, 4999))
                      .Take(1)
                      .FirstOrDefault();

            string pdfFile = "";
            var    error   = PurchasingService.CreatePurchaseOrderPdf(poh,
                                                                      testCompany.POSupplierTemplateId, //DocumentTemplateType.PurchaseOrder,
                                                                      null,
                                                                      ref pdfFile);

            MediaServices.AddFileToLog(pdfFile, 20);        // So it gets cleaned up later

            Assert.IsTrue(!error.IsError, error.Message);
        }
        public void SendPurchaseOrderToSupplierTest()
        {
            // Get a test user and test company
            var testUser    = GetTestUser();
            var testCompany = GetTestCompany(testUser, true);
            var poh         = GetTestPurchaseOrderHeader(testCompany, testUser, 58);

            // Copy the purchase order to the temp tables
            var poht = PurchasingService.CopyPurchaseOrderToTemp(testCompany, poh, testUser);

            // Create the PDF
            string pdfFile = "";
            var    error   = PurchasingService.CreatePurchaseOrderPdf(poh,
                                                                      testCompany.POSupplierTemplateId, //DocumentTemplateType.PurchaseOrder,
                                                                      null,
                                                                      ref pdfFile);

            Assert.IsTrue(!error.IsError, error.Message);

            // Send the purchase order
            FilePackagerService.FilePackagerService fpService = new FilePackagerService.FilePackagerService(db);
            error = fpService.SendPurchaseOrderToSupplier(poht.Id, testUser, pdfFile);
            Assert.IsTrue(!error.IsError, error.Message);
        }