Ejemplo n.º 1
0
        public void Cells_Throws()
        {
            var record = new GraphvizRecord();

            // ReSharper disable once AssignNullToNotNullAttribute
            Assert.Throws <ArgumentNullException>(() => record.Cells = null);
        }
Ejemplo n.º 2
0
        public void Cells()
        {
            var record = new GraphvizRecord();

            if (record.Cells is null)
            {
                throw new InvalidOperationException($"Cell has null {nameof(GraphvizRecord.Cells)}.");
            }

            var recordCollection = new GraphvizRecordCellCollection();

            record.Cells = recordCollection;
            Assert.AreSame(recordCollection, record.Cells);
        }
Ejemplo n.º 3
0
        private void FormatVertex(object sender, FormatVertexEventArgs <ExpandingNode> e)
        {
            ExpandingNode ent = e.Vertex;

            //e.VertexFormatter.Label = ent.GetName();
            e.VertexFormatter.Shape = GraphvizVertexShape.Record;
            e.VertexFormatter.Style = GraphvizVertexStyle.Filled;

            switch (ent.state)
            {
            case ExpandingNode.STATE.NEW:
                e.VertexFormatter.FillColor = Color.Orange;
                break;

            case ExpandingNode.STATE.EXPANDED:
                e.VertexFormatter.FillColor = Color.Red;
                break;

            case ExpandingNode.STATE.FREEZED:
                e.VertexFormatter.FillColor = Color.LightBlue;
                break;
            }

            GraphvizRecord rec = new GraphvizRecord();

            GraphvizRecordCell name = new GraphvizRecordCell();

            name.Text = ent.GetName();

            GraphvizRecordCell maxScore = new GraphvizRecordCell();

            maxScore.Text = ent.maxVal.ToString();

            GraphvizRecordCell minScore = new GraphvizRecordCell();

            minScore.Text = ent.minVal.ToString();

            rec.Cells.Add(name);
            rec.Cells.Add(maxScore);
            rec.Cells.Add(minScore);

            e.VertexFormatter.Record = rec;
        }
Ejemplo n.º 4
0
 public void ToDot([NotNull] GraphvizRecord record, [NotNull] string expectedDot)
 {
     Assert.AreEqual(expectedDot, record.ToDot());
     Assert.AreEqual(expectedDot, record.ToString());
 }
Ejemplo n.º 5
0
        public void Constructor()
        {
            var record = new GraphvizRecord();

            CollectionAssert.IsEmpty(record.Cells);
        }