@@ -774,7 +774,8 @@ private static System.Collections.IEnumerable YieldTestCases_ProcessCommandAsync
774774 updateRate : null ,
775775 width : width ,
776776 height : height ,
777- order : null
777+ order : null ,
778+ totalValueLabel : null
778779 ) ;
779780
780781 var plugin = PluginFactory . CreatePlugin (
@@ -817,7 +818,8 @@ private static System.Collections.IEnumerable YieldTestCases_ProcessCommandAsync
817818 updateRate : updateRate ,
818819 width : null ,
819820 height : null ,
820- order : null
821+ order : null ,
822+ totalValueLabel : null
821823 ) ;
822824
823825 var plugin = PluginFactory . CreatePlugin (
@@ -890,7 +892,8 @@ private static System.Collections.IEnumerable YieldTestCases_ProcessCommandAsync
890892 updateRate : TimeSpan . FromMinutes ( 1 ) ,
891893 width : null ,
892894 height : null ,
893- order : order
895+ order : order ,
896+ totalValueLabel : null
894897 ) ;
895898
896899 var plugin = PluginFactory . CreatePlugin (
@@ -947,6 +950,80 @@ await StartSession(
947950 ) ;
948951 }
949952
953+ private static System . Collections . IEnumerable YieldTestCases_ProcessCommandAsync_ConfigCommand_GraphTotal ( )
954+ {
955+ foreach ( var total in new [ ] {
956+ null ,
957+ string . Empty ,
958+ "Total" ,
959+ } ) {
960+ var graphAttrs = new PluginGraphAttributes (
961+ title : "title" ,
962+ category : "test" ,
963+ verticalLabel : "test" ,
964+ scale : false ,
965+ arguments : "--args" ,
966+ updateRate : TimeSpan . FromMinutes ( 1 ) ,
967+ width : null ,
968+ height : null ,
969+ order : null ,
970+ totalValueLabel : total
971+ ) ;
972+
973+ var plugin = PluginFactory . CreatePlugin (
974+ "plugin1" ,
975+ graphAttrs ,
976+ new [ ] {
977+ PluginFactory . CreateField ( "plugin1field1" , static ( ) => 1.1 ) ,
978+ PluginFactory . CreateField ( "plugin1field2" , PluginFieldGraphStyle . LineWidth3 , static ( ) => 1.2 )
979+ }
980+ ) ;
981+
982+ yield return new object [ ] {
983+ plugin ,
984+ new Action < IReadOnlyList < string > > (
985+ responseLines => {
986+ if ( string . IsNullOrEmpty ( total ) )
987+ Assert . That ( responseLines , Has . No . Member ( "graph_total " ) , "graph_total" ) ;
988+ else
989+ Assert . That ( responseLines , Has . Member ( $ "graph_total { total } ") , "graph_total" ) ;
990+ }
991+ )
992+ } ;
993+ }
994+ }
995+
996+ [ TestCaseSource ( nameof ( YieldTestCases_ProcessCommandAsync_ConfigCommand_GraphTotal ) ) ]
997+ public async Task ProcessCommandAsync_ConfigCommand_GraphTotal (
998+ IPlugin plugin ,
999+ Action < IReadOnlyList < string > > assertResponseLines
1000+ )
1001+ {
1002+ await StartSession (
1003+ plugins : new [ ] { plugin } ,
1004+ action : async ( node , client , writer , reader , cancellationToken ) => {
1005+ await writer . WriteLineAsync ( $ "config { plugin . Name } ", cancellationToken ) ;
1006+ await writer . FlushAsync ( cancellationToken ) ;
1007+
1008+ var lines = new List < string > ( ) ;
1009+
1010+ for ( ; ; ) {
1011+ var line = await reader . ReadLineAsync ( cancellationToken ) ;
1012+
1013+ if ( line is null )
1014+ break ;
1015+
1016+ lines . Add ( line ) ;
1017+
1018+ if ( line == "." )
1019+ break ;
1020+ }
1021+
1022+ assertResponseLines ( lines ) ;
1023+ }
1024+ ) ;
1025+ }
1026+
9501027 [ TestCase ( PluginFieldGraphStyle . Default , null , null ) ]
9511028 [ TestCase ( PluginFieldGraphStyle . Area , "AREA" , null ) ]
9521029 [ TestCase ( PluginFieldGraphStyle . Stack , "STACK" , null ) ]
0 commit comments