Esempio n. 1
0
        public void AreStreamContentEqual()
        {
            string assemblyPath = Assembly.GetExecutingAssembly().Location;
            string path         = Path.GetDirectoryName(assemblyPath);
            string pathFile     = Path.Combine(path, "MbUnitFileAssert_Test.tmp");


            try
            {
                StreamWriter strWriter = new StreamWriter(pathFile);

                strWriter.WriteLine("Testing MbUnit");
                strWriter.Close();

                Stream str = new FileStream(pathFile, FileMode.Open);

                File.Copy(pathFile, pathFile + "TestCopy", true);
                Stream str2 = new FileStream(pathFile + "TestCopy", FileMode.Open);

                OldFileAssert.AreStreamContentEqual(str, str2);
            }
            finally
            {
                File.Delete(pathFile + "TestCopy");
            }
        }
Esempio n. 2
0
        public void AreEqualFileInfo()
        {
            string   pathFile = Assembly.GetExecutingAssembly().Location;
            FileInfo file     = new FileInfo(pathFile);
            FileInfo file2    = new FileInfo(pathFile);

            OldFileAssert.AreEqual(file, file2);
        }
Esempio n. 3
0
        public void SaveToFileStream()
        {
            string outputPath = "Documents/SaveToFileStream.pdf";

            File.Delete(outputPath);

            using (FileStream stream = File.OpenWrite(outputPath))
            {
                PdfTemplate template = PdfTemplate.Open("Documents/Template.pdf");
                template.RemoveUsageRights = true;
                template.Save(stream);
            }

            OldFileAssert.Exists(outputPath);
        }
Esempio n. 4
0
        public void FillPdf()
        {
            const string outputPath = "Documents/FillPdf.pdf";

            File.Delete(outputPath);

            Pdf.MetaData meta = new Pdf.MetaData
            {
                Title    = "OmniMount Invoice",
                Creator  = "PdfFormTests.FillPdf()",
                Author   = "Colossus Interactive",
                Keywords = "Test, Test2",
                Subject  = "Consumer Website Payment 1 Invoice."
            };

            PdfFormValues formValues = new PdfFormValues();

            formValues.Add("BillTo[0]", "OmniMount Systems");
            formValues.Add("BillTo[1]", "8201 South 48th Street");
            formValues.Add("BillTo[2]", "Phoenix, AZ 85044");
            formValues.Add("InvoiceNumber", "1234567");
            formValues.Add("PONumber", "34523452");
            formValues.Add("For", "OmniMount Consumer Website");
            formValues.Add("Terms", "Net 30 days.");
            formValues.Add("TaxID", "26-2911208");
            formValues.Add("InvoiceDate", DateTime.Now.ToShortDateString());
            formValues.Add("BilledItem[0]", "Initial retainer for start of consumer website project.");
            formValues.Add("BilledAmount[0]", "$26,234.30");
            formValues.Add("BilledItem[1]", "Some other money I think I should get.");
            formValues.Add("BilledAmount[1]", "$1,000.00");
            formValues.Add("Subtotal", "$27,234.30");
            formValues.Add("Tax", "$0.00");
            formValues.Add("Total", "$27,234.30");

            PdfTemplate template = PdfTemplate.Open("Documents/Template.pdf");

            template.MetaData   = meta;
            template.FormValues = formValues;
            template.Generate(outputPath);

            OldFileAssert.Exists(outputPath);
        }
Esempio n. 5
0
        public void NotExists()
        {
            string path = Assembly.GetExecutingAssembly().Location;

            OldFileAssert.NotExists(path + "MbUnitTest");
        }
Esempio n. 6
0
        public void Exists()
        {
            string path = Assembly.GetExecutingAssembly().Location;

            OldFileAssert.Exists(path);
        }
Esempio n. 7
0
        public void AreEqualPath()
        {
            string pathFile = Assembly.GetExecutingAssembly().Location;

            OldFileAssert.AreEqual(pathFile, pathFile);
        }