public void TestFillPostDictionaryReturnResultPdf()
        {
            IDictionary <string, PdfField> myList = new Dictionary <string, PdfField>();
            var pdfService = new Mock <IPdfService>();

            pdfService.Setup(p => p.DownloadUrl(It.IsAny <string>())).Returns(new MemoryStream());
            pdfService.Setup(p => p.FillForm(It.IsAny <Stream>(), It.IsAny <IDictionary <string, string> >())).Returns(new MemoryStream());

            using (var controller = new PdfFormController(pdfService.Object))
            {
                controller.ControllerContext = this.GetControllerContext();
                controller.Fill("https://www.irs.gov/pub/irs-pdf/fw9.pdf", new Dictionary <string, string>());
            }

            pdfService.VerifyAll();
        }
        public void TestFillGetReturnModelThatHelpGenerateDynamicForm()
        {
            IDictionary <string, PdfField> myList = new Dictionary <string, PdfField>();
            var pdfService = new Mock <IPdfService>();

            pdfService.Setup(p => p.DownloadUrl(It.IsAny <string>())).Returns(new MemoryStream());

            pdfService.Setup(p => p.GetFormFields(It.IsAny <Stream>())).Returns(myList);
            using (var controller = new PdfFormController(pdfService.Object))
            {
                controller.ControllerContext = this.GetControllerContext();
                controller.Fill("https://www.irs.gov/pub/irs-pdf/fw9.pdf");
            }

            pdfService.VerifyAll();
        }
        public void TestFillPostWithJsonFlattenAndReturnResultPdf()
        {
            var dummyItem = new
            {
                topmostSubform = new List <dynamic>()
                {
                    new { Page1 = new List <dynamic>()
                          {
                              new { Address = new List <dynamic>()
                                    {
                                        new { f1_7 = new List <string>()
                                              {
                                                  "Hello"
                                              } }
                                    } }
                          } }
                }
            };

            var     text  = JsonConvert.SerializeObject(dummyItem);
            JObject param = JObject.Parse(text);

            IDictionary <string, PdfField> myList = new Dictionary <string, PdfField>();
            var pdfService = new Mock <IPdfService>();

            pdfService.Setup(p => p.DownloadUrl(It.IsAny <string>())).Returns(new MemoryStream());
            pdfService.Setup(p => p.FillForm(It.IsAny <Stream>(), It.IsAny <IDictionary <string, string> >())).Returns(new MemoryStream());

            using (var controller = new PdfFormController(pdfService.Object))
            {
                controller.ControllerContext = this.GetControllerContext();
                controller.FillWithJson("https://www.irs.gov/pub/irs-pdf/fw9.pdf", param);
            }

            pdfService.VerifyAll();
        }