コード例 #1
0
        public void ParseSize()
        {
            GraphvizSize size = SvgHtmlWrapper.ParseSize(SampleSvg);

            Assert.AreEqual(new GraphvizSize(300, 200), size);

            // Size not found => fallback
            size = SvgHtmlWrapper.ParseSize(MissingSizeSampleSvg);
            Assert.AreEqual(new GraphvizSize(400, 400), size);
        }
コード例 #2
0
        public void DumpHtml()
        {
            const string svgFile        = "input.svg";
            string       svgFilePath    = Path.Combine(GetTemporaryTestDirectory(), svgFile);
            string       outputFilePath = SvgHtmlWrapper.DumpHtml(new GraphvizSize(150, 150), svgFilePath);

            // File exists and is valid HTML
            string htmlContent = CheckValidHtmlFile(outputFilePath);

            StringAssert.Contains(svgFilePath, htmlContent);
        }
コード例 #3
0
        public void WrapSvg()
        {
            const string svgFile     = "sample.svg";
            string       svgFilePath = Path.Combine(GetTemporaryTestDirectory(), svgFile);

            File.WriteAllText(svgFilePath, SampleSvg);
            if (!File.Exists(svgFilePath))
            {
                throw new InvalidOperationException("Failed to create test svg file.");
            }

            string outputFilePath = SvgHtmlWrapper.WrapSvg(svgFilePath);

            // File exists and is valid HTML
            string htmlContent = CheckValidHtmlFile(outputFilePath);

            StringAssert.Contains(svgFilePath, htmlContent);
        }
コード例 #4
0
 public void WrapSvg_Throws()
 {
     // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
     // ReSharper disable once AssignNullToNotNullAttribute
     Assert.Throws <ArgumentNullException>(() => SvgHtmlWrapper.WrapSvg(null));
 }
コード例 #5
0
 public void DumpHtml_Throws()
 {
     // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
     // ReSharper disable once AssignNullToNotNullAttribute
     Assert.Throws <ArgumentNullException>(() => SvgHtmlWrapper.DumpHtml(new GraphvizSize(150, 150), null));
 }