@@ -29,6 +29,12 @@ private V8ScriptEngine Js {
2929 new object [ ] { DiagramType . Graph , "flowchart" }
3030 ] ;
3131
32+ internal static readonly object [ ] FilterTestCases =
33+ [
34+ new object [ ] { DiagramType . Class , "Test" } ,
35+ new object [ ] { DiagramType . Graph , "Test" }
36+ ] ;
37+
3238 [ OneTimeTearDown ]
3339 public void Disposal ( )
3440 {
@@ -46,10 +52,13 @@ public void DogFoodSolutionTest(DiagramType type, string typeName)
4652 var graph = Commands . Solution ( info , type ) ;
4753
4854 Console . WriteLine ( graph ) ;
49-
55+ Assert . That ( graph , Is . Not . Null . Or . Empty , "Graph should not be null or empty." ) ;
56+ Assert . That ( graph , Does . Contain ( "mermaid-graph" ) ) ;
57+ Assert . That ( graph , Does . Contain ( "MermaidGraphTests" ) ) ;
5058 var graphType = DetectType ( ExtractMermaid ( graph ) ) ;
59+ Console . WriteLine ( $ "Detected type: { graphType } ") ;
60+
5161 Assert . That ( graphType , Is . EqualTo ( typeName ) ) ;
52- Console . WriteLine ( graphType ) ;
5362 }
5463
5564 [ Test ]
@@ -61,7 +70,9 @@ public void DogFoodProjectTest(DiagramType type, string typeName)
6170 var info = new FileInfo ( filePath ! ) ;
6271 Assert . That ( info . Exists ) ;
6372 var graph = Commands . Project ( info , type ) ;
64-
73+ Assert . That ( graph , Is . Not . Null . Or . Empty , "Graph should not be null or empty." ) ;
74+ Assert . That ( graph , Does . Contain ( "mermaid-graph" ) ) ;
75+ Assert . That ( graph , Does . Contain ( "MermaidGraphTests" ) ) ;
6576 Console . WriteLine ( graph ) ;
6677
6778 var graphType = DetectType ( ExtractMermaid ( graph ) ) ;
@@ -97,6 +108,24 @@ public void CommandLineFailTests(string? file, int hResult)
97108 Assert . That ( Program . Main ( file ) , Is . EqualTo ( hResult ) ) ;
98109 }
99110
111+ [ Test ]
112+ [ TestCaseSource ( nameof ( FilterTestCases ) ) ]
113+ public void DiagramsShouldNotContainFilteredContent ( DiagramType type , string filter )
114+ {
115+ var solutionPath = FindFileDownTree ( "*.sln" ) ;
116+ Assert . That ( solutionPath , Is . Not . Null ) ;
117+ var info = new FileInfo ( solutionPath ! ) ;
118+ Assert . That ( info . Exists ) ;
119+ var graph = Commands . Solution ( info , type ) ;
120+ Assert . That ( graph , Does . Contain ( filter ) ,
121+ $ "Original Graph should contain filtered content: { filter } ") ;
122+
123+ graph = Commands . Solution ( info , type , filter ) ;
124+ Console . WriteLine ( graph ) ;
125+ Assert . That ( graph , Does . Not . Contain ( filter ) ,
126+ $ "Graph should not contain filtered content: { filter } ") ;
127+ }
128+
100129 private static string ExtractMermaid ( string ? markup )
101130 {
102131 Assert . That ( markup , Does . StartWith ( MermaidDiagram . MermaidBegin ) ) ;
0 commit comments