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); }
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); }
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); }
public void WrapSvg_Throws() { // ReSharper disable once ReturnValueOfPureMethodIsNotUsed // ReSharper disable once AssignNullToNotNullAttribute Assert.Throws <ArgumentNullException>(() => SvgHtmlWrapper.WrapSvg(null)); }
public void DumpHtml_Throws() { // ReSharper disable once ReturnValueOfPureMethodIsNotUsed // ReSharper disable once AssignNullToNotNullAttribute Assert.Throws <ArgumentNullException>(() => SvgHtmlWrapper.DumpHtml(new GraphvizSize(150, 150), null)); }