コード例 #1
0
        public void RestartingListNumberingDynamicallyWhileMultipleInsertionsDocumentDynamically()
        {
            Document mainTemplate = DocumentHelper.CreateSimpleDocument("<<doc [src] -build>>");
            Document template1    = DocumentHelper.CreateSimpleDocument("<<doc [src1] -build>>");
            Document template2    = DocumentHelper.CreateSimpleDocument("<<doc [src2.Document] -build>>");

            DocumentTestClass doc = new DocumentTestBuilder()
                                    .WithDocument(new Document(MyDir + "Reporting engine template - List numbering.docx")).Build();

            BuildReport(mainTemplate, new object[] { template1, template2, doc, Common.GetManagers() }, new[] { "src", "src1", "src2", "Managers" }, ReportBuildOptions.RemoveEmptyParagraphs);

            mainTemplate.Save(ArtifactsDir + "ReportingEngine.RestartingListNumberingDynamicallyWhileMultipleInsertionsDocumentDynamically.docx");

            Assert.IsTrue(DocumentHelper.CompareDocs(ArtifactsDir + "ReportingEngine.RestartingListNumberingDynamicallyWhileMultipleInsertionsDocumentDynamically.docx", GoldsDir + "ReportingEngine.RestartingListNumberingDynamicallyWhileInsertingDocumentDynamically Gold.docx"));
        }
コード例 #2
0
        public void StringFormat()
        {
            Document doc = DocumentHelper.CreateSimpleDocument(
                "<<[s.Name]:lower>> says: <<[s.Message]:upper>>, <<[s.Message]:caps>>, <<[s.Message]:firstCap>>");

            MessageTestClass sender = new MessageTestClass("LINQ Reporting Engine", "hello world");

            BuildReport(doc, sender, "s");

            MemoryStream dstStream = new MemoryStream();

            doc.Save(dstStream, SaveFormat.Docx);

            Assert.AreEqual("linq reporting engine says: HELLO WORLD, Hello World, Hello world\f", doc.GetText());
        }
コード例 #3
0
        public void NumberFormat()
        {
            Document doc = DocumentHelper.CreateSimpleDocument(
                "<<[s.Value1]:alphabetic>> : <<[s.Value2]:roman:lower>>, <<[s.Value3]:ordinal>>, <<[s.Value1]:ordinalText:upper>>" +
                ", <<[s.Value2]:cardinal>>, <<[s.Value3]:hex>>, <<[s.Value3]:arabicDash>>");

            NumericTestClass sender = new NumericTestBuilder()
                                      .WithValuesAndDate(1, 2.2, 200, null, DateTime.Parse("10.09.2016 10:00:00")).Build();

            BuildReport(doc, sender, "s");

            doc = DocumentHelper.SaveOpen(doc);

            Assert.AreEqual("A : ii, 200th, FIRST, Two, C8, - 200 -\f", doc.GetText());
        }
コード例 #4
0
        public void InsertDocumentDinamicallyByUri()
        {
            Document template = DocumentHelper.CreateSimpleDocument("<<doc [src.DocumentUri]>>");

            DocumentTestClass docUri = new DocumentTestBuilder()
                                       .WithDocumentUri("http://www.snee.com/xml/xslt/sample.doc").Build();

            BuildReport(template, docUri, "src", ReportBuildOptions.None);
            template.Save(MyDir + @"\Artifacts\ReportingEngine.InsertDocumentDinamically.docx");

            Assert.IsTrue(
                DocumentHelper.CompareDocs(MyDir + @"\Artifacts\ReportingEngine.InsertDocumentDinamically.docx",
                                           MyDir + @"\Golds\ReportingEngine.InsertDocumentDinamically(uri) Gold.docx"),
                "Fail inserting document by uri");
        }
コード例 #5
0
        public void InsertDocumentDinamicallyByBytes()
        {
            Document template = DocumentHelper.CreateSimpleDocument("<<doc [src.DocumentBytes]>>");

            DocumentTestClass docBytes = new DocumentTestBuilder()
                                         .WithDocumentBytes(File.ReadAllBytes(MyDir + "ReportingEngine.TestDataTable.docx")).Build();

            BuildReport(template, docBytes, "src", ReportBuildOptions.None);
            template.Save(MyDir + @"\Artifacts\ReportingEngine.InsertDocumentDinamically.docx");

            Assert.IsTrue(
                DocumentHelper.CompareDocs(MyDir + @"\Artifacts\ReportingEngine.InsertDocumentDinamically.docx",
                                           MyDir + @"\Golds\ReportingEngine.InsertDocumentDinamically(stream,doc,bytes) Gold.docx"),
                "Fail inserting document by bytes");
        }
コード例 #6
0
        public void InsertDocumentDinamicallyByStream()
        {
            Document template = DocumentHelper.CreateSimpleDocument("<<doc [src.DocumentStream]>>");

            DocumentTestClass docStream = new DocumentTestBuilder()
                                          .WithDocumentStream(new FileStream(mDocument, FileMode.Open, FileAccess.Read)).Build();

            BuildReport(template, docStream, "src", ReportBuildOptions.None);
            template.Save(MyDir + @"\Artifacts\ReportingEngine.InsertDocumentDinamically.docx");

            Assert.IsTrue(
                DocumentHelper.CompareDocs(MyDir + @"\Artifacts\ReportingEngine.InsertDocumentDinamically.docx",
                                           MyDir + @"\Golds\ReportingEngine.InsertDocumentDinamically(stream,doc,bytes) Gold.docx"),
                "Fail inserting document by stream");
        }
コード例 #7
0
        public void InsertDocumentDinamicallyWithAdditionalTemplateChecking()
        {
            Document template = DocumentHelper.CreateSimpleDocument("<<doc [src.Document] -build>>");

            DocumentTestClass doc = new DocumentTestBuilder()
                                    .WithDocument(new Document(MyDir + "ReportingEngine.TestDataTable.docx")).Build();

            BuildReport(template, new object[] { doc, Common.GetContracts() }, new[] { "src", "Contracts" },
                        ReportBuildOptions.None);
            template.Save(
                ArtifactsDir + "ReportingEngine.InsertDocumentDinamicallyWithAdditionalTemplateChecking.docx");

            Assert.IsTrue(
                DocumentHelper.CompareDocs(
                    ArtifactsDir + "ReportingEngine.InsertDocumentDinamicallyWithAdditionalTemplateChecking.docx",
                    GoldsDir + "ReportingEngine.InsertDocumentDinamicallyWithAdditionalTemplateChecking Gold.docx"),
                "Fail inserting document by document");
        }
コード例 #8
0
        public void InsertDocumentDinamically()
        {
            // By stream
            Document template = DocumentHelper.CreateSimpleDocument("<<doc [src.DocumentByStream]>>");

            DocumentDataSource docStream = new DocumentDataSource(new FileStream(this._doc, FileMode.Open, FileAccess.Read));

            BuildReport(template, docStream, "src", ReportBuildOptions.None);
            template.Save(MyDir + @"\Artifacts\ReportingEngine.InsertDocumentDinamically.docx");

            Assert.IsTrue(DocumentHelper.CompareDocs(MyDir + @"\Artifacts\ReportingEngine.InsertDocumentDinamically.docx", MyDir + @"\Golds\ReportingEngine.InsertDocumentDinamically(stream,doc,bytes) Gold.docx"), "Fail inserting document by stream");

            // By doc
            template = DocumentHelper.CreateSimpleDocument("<<doc [src.Document]>>");

            DocumentDataSource docByDoc = new DocumentDataSource(new Document(MyDir + "ReportingEngine.TestDataTable.docx"));

            BuildReport(template, docByDoc, "src", ReportBuildOptions.None);
            template.Save(MyDir + @"\Artifacts\ReportingEngine.InsertDocumentDinamically.docx");

            Assert.IsTrue(DocumentHelper.CompareDocs(MyDir + @"\Artifacts\ReportingEngine.InsertDocumentDinamically.docx", MyDir + @"\Golds\ReportingEngine.InsertDocumentDinamically(stream,doc,bytes) Gold.docx"), "Fail inserting document by document");

            // By uri
            template = DocumentHelper.CreateSimpleDocument("<<doc [src.DocumentByUri]>>");

            DocumentDataSource docByUri = new DocumentDataSource("http://www.sample-videos.com/doc/Sample-doc-file-100kb.doc");

            BuildReport(template, docByUri, "src", ReportBuildOptions.None);
            template.Save(MyDir + @"\Artifacts\ReportingEngine.InsertDocumentDinamically.docx");

            Assert.IsTrue(DocumentHelper.CompareDocs(MyDir + @"\Artifacts\ReportingEngine.InsertDocumentDinamically.docx", MyDir + @"\Golds\ReportingEngine.InsertDocumentDinamically(uri) Gold.docx"), "Fail inserting document by uri");

            // By byte
            template = DocumentHelper.CreateSimpleDocument("<<doc [src.DocumentByByte]>>");

            DocumentDataSource docByByte = new DocumentDataSource(File.ReadAllBytes(MyDir + "ReportingEngine.TestDataTable.docx"));

            BuildReport(template, docByByte, "src", ReportBuildOptions.None);
            template.Save(MyDir + @"\Artifacts\ReportingEngine.InsertDocumentDinamically.docx");

            Assert.IsTrue(DocumentHelper.CompareDocs(MyDir + @"\Artifacts\ReportingEngine.InsertDocumentDinamically.docx", MyDir + @"\Golds\ReportingEngine.InsertDocumentDinamically(stream,doc,bytes) Gold.docx"), "Fail inserting document by bytes");
        }