public void Cells_Throws()
        {
            var record = new GraphvizRecord();

            // ReSharper disable once AssignNullToNotNullAttribute
            Assert.Throws <ArgumentNullException>(() => record.Cells = null);
        }
        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);
        }
Exemple #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;
        }
 public void ToDot([NotNull] GraphvizRecord record, [NotNull] string expectedDot)
 {
     Assert.AreEqual(expectedDot, record.ToDot());
     Assert.AreEqual(expectedDot, record.ToString());
 }
        public void Constructor()
        {
            var record = new GraphvizRecord();

            CollectionAssert.IsEmpty(record.Cells);
        }