コード例 #1
0
        internal void UploadTemplateToCloud(string fileName)
        {
            var filePath   = Path.Combine(TestContext.CurrentContext.TestDirectory, "Forms", fileName);
            var pdfStorage = new PdfStorage();

            pdfStorage.UploadTemplate(filePath, fileName);
        }
コード例 #2
0
            public void WhenTemplateExistInCloud_ShouldReturnClonedFileName()
            {
                // arrange
                var pdfTestUtils = new PdfTestUtils();
                var templateName = "BootCampForm-v2.pdf";
                var filePath     = pdfTestUtils.CreateTemplatePath(templateName);
                var pdfStorage   = new PdfStorage();

                pdfStorage.UploadTemplate(filePath, templateName);
                // act
                var actual = pdfStorage.CloneTemplate(templateName);

                // assert
                actual.Should().Contain(templateName);
            }
コード例 #3
0
            public void WhenFileExistInCloud_ShouldBeAbleToDownloadFile()
            {
                // arrange
                var pdfTestUtils = new PdfTestUtils();
                var templateName = "BootCampForm-v2.pdf";
                var filePath     = pdfTestUtils.CreateTemplatePath(templateName);
                var pdfStorage   = new PdfStorage();

                pdfStorage.UploadTemplate(filePath, templateName);
                // act
                var actual = pdfStorage.Download(templateName);
                // assert
                var expectedLength = FetchBootCampFormExpectedLength(filePath);

                actual.Length.Should().Be(expectedLength);
            }
コード例 #4
0
            public void WhenTemplateNotPresent_ShouldReturnErrors()
            {
                // arrange
                var pdfTestUtils = new PdfTestUtils();
                var templateName = "BootCampForm-DOESNOTEXIST-v2.pdf";
                var filePath     = pdfTestUtils.CreateTemplatePath(templateName);
                var pdfStorage   = new PdfStorage();
                // act
                var actual = pdfStorage.UploadTemplate(filePath, templateName);
                // assert
                var expected = new UploadResult {
                    Successful = false, Errors = { "Cannot locate pdf template [BootCampForm-DOESNOTEXIST-v2.pdf]" }
                };

                actual.Should().BeEquivalentTo(expected);
            }
コード例 #5
0
            public void WhenWhiteSpaceOrNullStorageFilename_ShouldReturnErrors(string fileName)
            {
                // arrange
                var pdfTestUtils = new PdfTestUtils();
                var templateName = "BootCampForm-v2.pdf";
                var filePath     = pdfTestUtils.CreateTemplatePath(templateName);
                var pdfStorage   = new PdfStorage();
                // act
                var actual = pdfStorage.UploadTemplate(filePath, fileName);
                // assert
                var expected = new UploadResult {
                    Successful = false, Errors = { "Storage Filename cannot be whitespace or null" }
                };

                actual.Should().BeEquivalentTo(expected);
            }
コード例 #6
0
            public void WhenTemplateExistLocally_ShouldUploadPdf()
            {
                // arrange
                var pdfTestUtils = new PdfTestUtils();
                var templateName = "BootCampForm-v2.pdf";
                var filePath     = pdfTestUtils.CreateTemplatePath(templateName);
                var pdfStorage   = new PdfStorage();
                // act
                var actual = pdfStorage.UploadTemplate(filePath, templateName);
                // assert
                var expected = new UploadResult {
                    Successful = true
                };

                actual.Should().BeEquivalentTo(expected);
            }
コード例 #7
0
 public PdfController(PdfStorage pdfStorage)
 {
     this.pdfStorage = pdfStorage;
 }