When verifying a pipeline graph, you can generate either a GraphViz diagram or an image in PNG or SVG format. This is done using ApprovalTests.
If you want to verify a Pipeline
, you can call PipelineApprovals.Verify()
:
var input = new InputPipe<long>("value");
input.ProcessFunction(LongToString);
input.ProcessFunction(IncrementLong);
PipelineApprovals.Verify(input);
Which produces the following approved file:
digraph G { node [style=filled, shape=rect]
# Nodes
"Int64 value" -> "PipelineTests.LongToString()" -> "String"
"Int64 value" -> "PipelineTests.IncrementLong()" -> "Int64"
# Formatting
"Int64 value" [color=green]
"String" [color="#9fbff4"]
"PipelineTests.LongToString()" [shape=invhouse]
"Int64" [color="#9fbff4"]
"PipelineTests.IncrementLong()" [shape=invhouse]
}
Usually we open these in Visual Studio Code with a plugin. The advantage of these files is that they diff easily and render nicely.
If you want to create the images, you can do that automatically as well, using the following:
var input = CreateQuickPipelineWithInput();
PipelineApprovals.VerifyAsPng(input);
which produces the following approved file: