Esempio n. 1
0
        public void CopyPdfFormToBlazorProject_InvalidPathToPdfFormSource_ShouldThrow()
        {
            Action action = () => FileCopier.CopyPdfFormToBlazorProject(@"C:\IShouldNotExist.pdf", string.Empty);

            var exception = Assert.Throws <ArgumentException>(action);

            Assert.Equal("Invalid path to source PDF form.", exception.Message);
        }
Esempio n. 2
0
        public void CopyPdfFormToBlazorProject_PdfFormSourceNotProvided_ShouldThrow()
        {
            Action action = () => FileCopier.CopyPdfFormToBlazorProject(string.Empty, string.Empty);

            var exception = Assert.Throws <ArgumentException>(action);

            Assert.Equal("Path to source PDF form not provided.", exception.Message);
        }
Esempio n. 3
0
        public void CanCopyPdfFormFile()
        {
            var pdfFormFinder      = new PdfFormFinder(AppDomain.CurrentDomain.BaseDirectory);
            var pdfFormDestination = pdfFormFinder.GetPath();

            if (File.Exists(pdfFormDestination))
            {
                File.Delete(pdfFormDestination);
            }

            Assert.False(File.Exists(pdfFormDestination));

            var pdfFormSource = @"FileManipulation\SamplePDFs\PRP-1-bos.pdf";

            FileCopier.CopyPdfFormToBlazorProject(pdfFormSource, pdfFormDestination);

            Assert.True(File.Exists(pdfFormDestination));
        }
Esempio n. 4
0
        private static void CopyPdfFormToWebsite(string pathToPdfForm)
        {
            Console.WriteLine("PDFiller - a tool that helps you create a simple static website based on your fillable PDF form.");
            Console.WriteLine();
            Console.WriteLine("Enter a path to the PDF form:");
            var pdfFormSource = Console.ReadLine();

            if (string.IsNullOrEmpty(pdfFormSource) || !File.Exists(pdfFormSource))
            {
                Console.WriteLine("You have to provide a valid path to a PDF form");
                Environment.Exit(0);
            }

            Console.WriteLine("Copying PDF form to the website:");
            Console.WriteLine(@$ "" "{pdfFormSource}" "");
            Console.WriteLine("To:");
            Console.WriteLine(@$ "" "{pathToPdfForm}" "");

            FileCopier.CopyPdfFormToBlazorProject(pdfFormSource, pathToPdfForm);
        }