コード例 #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");
            }
        }
コード例 #2
0
        public void AreEqualFileInfo()
        {
            string   pathFile = Assembly.GetExecutingAssembly().Location;
            FileInfo file     = new FileInfo(pathFile);
            FileInfo file2    = new FileInfo(pathFile);

            OldFileAssert.AreEqual(file, file2);
        }
コード例 #3
0
ファイル: PdfFormTests.cs プロジェクト: brhinescot/Loom
        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);
        }
コード例 #4
0
ファイル: PdfFormTests.cs プロジェクト: brhinescot/Loom
        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);
        }
コード例 #5
0
        public void NotExists()
        {
            string path = Assembly.GetExecutingAssembly().Location;

            OldFileAssert.NotExists(path + "MbUnitTest");
        }
コード例 #6
0
        public void Exists()
        {
            string path = Assembly.GetExecutingAssembly().Location;

            OldFileAssert.Exists(path);
        }
コード例 #7
0
        public void AreEqualPath()
        {
            string pathFile = Assembly.GetExecutingAssembly().Location;

            OldFileAssert.AreEqual(pathFile, pathFile);
        }