Beispiel #1
0
 /// <summary>
 /// Default contructor
 /// </summary>
 public GraphvizGraph()
 {
     m_Url                = null;
     m_BackgroundColor    = Color.White;
     m_IsCentered         = false;
     m_ClusterRank        = ClusterMode.Local;
     m_Comment            = null;
     m_IsCompounded       = false;
     m_IsConcentrated     = false;
     m_Font               = null;
     m_FontColor          = Color.Black;
     m_Label              = null;
     m_LabelJustification = LabelJustification.C;
     m_LabelLocation      = LabelLocation.B;
     m_Layers             = new GraphvizLayerCollection();
     m_McLimit            = 1.0;
     m_NodeSeparation     = 0.25;
     m_IsNormalized       = false;
     m_NsLimit            = -1;
     m_NsLimit1           = -1;
     m_OutputOrder        = OutputMode.BreadthFirst;
     m_PageSize           = new Size(0, 0);
     m_PageDirection      = PageDirection.BL;
     m_Quantum            = 0;
     m_RankSeparation     = 0.5;
     m_Ratio              = RatioMode.Auto;
     m_IsReMinCross       = false;
     m_Resolution         = 0.96;
     m_Rotate             = 0;
     m_SamplePoints       = 8;
     m_SearchSize         = 30;
     m_Size               = new Size(0, 0);
     m_StyleSheet         = null;
 }
        public void ToDot()
        {
            var layerCollection = new GraphvizLayerCollection();

            Assert.AreEqual(string.Empty, layerCollection.ToDot());

            layerCollection = new GraphvizLayerCollection(new[]
            {
                new GraphvizLayer("L0")
            });
            Assert.AreEqual(
                "layers=\"L0\"; layersep=\":\"",
                layerCollection.ToDot());

            layerCollection = new GraphvizLayerCollection(new[]
            {
                new GraphvizLayer("L1"),
                new GraphvizLayer("L2"),
                new GraphvizLayer("L3")
            });
            Assert.AreEqual(
                "layers=\"L1:L2:L3\"; layersep=\":\"",
                layerCollection.ToDot());

            layerCollection.Separators = " ";
            Assert.AreEqual(
                "layers=\"L1 L2 L3\"; layersep=\" \"",
                layerCollection.ToDot());

            layerCollection.Separators = " -/";
            Assert.AreEqual(
                "layers=\"L1 -/L2 -/L3\"; layersep=\" -/\"",
                layerCollection.ToDot());
        }
        public void Separators_Throws()
        {
            var layerCollection = new GraphvizLayerCollection();

            // ReSharper disable ObjectCreationAsStatement
            // ReSharper disable once AssignNullToNotNullAttribute
            Assert.Throws <ArgumentException>(() => layerCollection.Separators = null);
            Assert.Throws <ArgumentException>(() => layerCollection.Separators = "");
            // ReSharper restore ObjectCreationAsStatement
        }
        public void Separators()
        {
            var layerCollection = new GraphvizLayerCollection();

            if (layerCollection.Separators != ":")
            {
                throw new InvalidOperationException("Collection has wong separators.");
            }

            layerCollection.Separators = ":,-";
            Assert.AreEqual(":,-", layerCollection.Separators);
        }
        public void Constructor()
        {
            var layerCollection = new GraphvizLayerCollection();

            CollectionAssert.IsEmpty(layerCollection);
            Assert.AreEqual(":", layerCollection.Separators);

            var layer1 = new GraphvizLayer("L1");

            layerCollection.Add(layer1);
            CollectionAssert.AreEqual(new[] { layer1 }, layerCollection);

            var layer2     = new GraphvizLayer("L2");
            var layerArray = new[] { layer1, layer2 };

            layerCollection = new GraphvizLayerCollection(layerArray);
            CollectionAssert.AreEqual(layerArray, layerCollection);
            Assert.AreEqual(":", layerCollection.Separators);

            var otherLayerCollection = new GraphvizLayerCollection(layerCollection);

            CollectionAssert.AreEqual(layerCollection, otherLayerCollection);
            Assert.AreEqual(":", otherLayerCollection.Separators);
        }