示例#1
0
        public virtual void ParseCurrentVersionTest()
        {
            iText.Kernel.Version instance = iText.Kernel.Version.GetInstance();
            // expected values
            String release = instance.GetRelease();
            String major   = "7";
            String minor   = iText.IO.Util.StringUtil.Split(release, "\\.")[1];

            String[] parseResults = iText.Kernel.Version.ParseVersionString(release);
            NUnit.Framework.Assert.AreEqual(2, parseResults.Length);
            NUnit.Framework.Assert.AreEqual(major, parseResults[0]);
            NUnit.Framework.Assert.AreEqual(minor, parseResults[1]);
        }
示例#2
0
        public virtual void ParseCustomCorrectVersionTest()
        {
            iText.Kernel.Version customVersion = new iText.Kernel.Version(new VersionInfo("iText®", "7.5.1-SNAPSHOT",
                                                                                          "iText® 7.5.1-SNAPSHOT ©2000-2090 iText Group NV (AGPL-version)", null), false);
            // expected values
            String major = "7";
            String minor = "5";

            String[] parseResults = iText.Kernel.Version.ParseVersionString(customVersion.GetRelease());
            NUnit.Framework.Assert.AreEqual(2, parseResults.Length);
            NUnit.Framework.Assert.AreEqual(major, parseResults[0]);
            NUnit.Framework.Assert.AreEqual(minor, parseResults[1]);
        }
示例#3
0
        private static void CheckVersionInstance(iText.Kernel.Version instance)
        {
            String      product = instance.GetProduct();
            String      release = instance.GetRelease();
            String      version = instance.GetVersion();
            String      key     = instance.GetKey();
            VersionInfo info    = instance.GetInfo();

            NUnit.Framework.Assert.AreEqual(product, info.GetProduct());
            NUnit.Framework.Assert.AreEqual("iText®", product);
            NUnit.Framework.Assert.AreEqual(release, info.GetRelease());
            NUnit.Framework.Assert.IsTrue(release.Matches("[7]\\.[0-9]+\\.[0-9]+(-SNAPSHOT)?$"));
            NUnit.Framework.Assert.AreEqual(version, info.GetVersion());
            NUnit.Framework.Assert.IsTrue(CheckVersion(version));
            NUnit.Framework.Assert.IsNull(key);
        }
        public string Get()
        {
            var    ms       = new MemoryStream();
            var    writer   = new PdfWriter(ms);
            var    pdf      = new PdfDocument(writer);
            var    document = new Document(pdf);
            var    info     = new iText.Kernel.Version();
            string result   = "ab-itext-dotnetcore-poc: " + info.GetProduct() + "," + info.GetRelease() + "," + info.GetVersion();

            // result.Content = new StreamContent(ms);
            // result.Content.Headers.ContentType =
            //     new MediaTypeHeaderValue("application/octet-stream");
            return(result);
        }