public static string ToGraphviz( #if !NET20 this #endif DataSetGraph visitedGraph) { Contract.Requires(visitedGraph != null); var algorithm = new DataSetGraphvizAlgorithm(visitedGraph); return algorithm.Generate(); }
public void Constructor_Throws() { // ReSharper disable ObjectCreationAsStatement // ReSharper disable AssignNullToNotNullAttribute Assert.Throws <ArgumentNullException>(() => new DataSetGraphvizAlgorithm(null)); Assert.Throws <ArgumentNullException>(() => new DataSetGraphvizAlgorithm(null, GraphvizImageType.Gif)); DataSetGraph graph = new DataSet().ToGraph(); var algorithm = new DataSetGraphvizAlgorithm(graph); Assert.Throws <ArgumentNullException>(() => algorithm.VisitedGraph = null); // ReSharper restore AssignNullToNotNullAttribute // ReSharper restore ObjectCreationAsStatement }
public void Generate_Throws() { var dotEngine = new TestDotEngine(); DataSetGraph graph = new DataSet().ToGraph(); var algorithm = new DataSetGraphvizAlgorithm(graph); // ReSharper disable AssignNullToNotNullAttribute Assert.Throws <ArgumentNullException>(() => algorithm.Generate(null, "NotSaved.dot")); Assert.Throws <ArgumentException>(() => algorithm.Generate(dotEngine, null)); Assert.Throws <ArgumentException>(() => algorithm.Generate(dotEngine, string.Empty)); Assert.Throws <ArgumentNullException>(() => algorithm.Generate(null, null)); Assert.Throws <ArgumentNullException>(() => algorithm.Generate(null, string.Empty)); // ReSharper restore AssignNullToNotNullAttribute }
public void Constructor() { DataSetGraph graph = new DataSet().ToGraph(); DataSetGraph otherGraph = new DataSet().ToGraph(); var algorithm = new DataSetGraphvizAlgorithm(graph); AssertAlgorithmProperties(algorithm, graph); algorithm = new DataSetGraphvizAlgorithm(graph, GraphvizImageType.Fig); AssertAlgorithmProperties(algorithm, graph, GraphvizImageType.Fig); algorithm = new DataSetGraphvizAlgorithm(graph, GraphvizImageType.Ps); AssertAlgorithmProperties(algorithm, graph, GraphvizImageType.Ps); algorithm = new DataSetGraphvizAlgorithm(graph, GraphvizImageType.Hpgl); algorithm.ImageType = GraphvizImageType.Gd; AssertAlgorithmProperties(algorithm, graph, GraphvizImageType.Gd); algorithm = new DataSetGraphvizAlgorithm(graph); algorithm.VisitedGraph = otherGraph; AssertAlgorithmProperties(algorithm, otherGraph); #region Local function void AssertAlgorithmProperties( DataSetGraphvizAlgorithm algo, DataSetGraph treatedGraph, GraphvizImageType imageType = GraphvizImageType.Png) { Assert.AreSame(treatedGraph, algo.VisitedGraph); Assert.IsNotNull(algo.GraphFormat); Assert.IsNotNull(algo.CommonVertexFormat); Assert.IsNotNull(algo.CommonEdgeFormat); Assert.AreEqual(imageType, algo.ImageType); Assert.IsNull(algo.Output); } #endregion }
public string Generate([NotNull] DataSet dataSet) { var algorithm = new DataSetGraphvizAlgorithm(dataSet.ToGraph()); return(algorithm.Generate()); }