@@ -86,7 +86,7 @@ public void UsagePrinterPrintsOptionCorrectly()
8686
8787 parser . Parse ( new [ ] { "-o" , "--help" } ) ;
8888
89- printerMock . Verify ( mock => mock . PrintUsage ( It . IsAny < IArgument > ( ) ) , Times . Once ( ) ) ;
89+ printerMock . Verify ( mock => mock . PrintOptionUsage ( It . IsAny < ICommandLineOption > ( ) ) , Times . Once ( ) ) ;
9090 }
9191
9292 [ Fact ]
@@ -105,7 +105,7 @@ public void UsagePrinterPrintsCommandCorrectly()
105105
106106 parser . Parse ( new [ ] { "-o" , "bla" , "cmd" , "--help" } ) ;
107107
108- printerMock . Verify ( mock => mock . PrintUsage ( It . IsAny < IArgument > ( ) ) , Times . Once ( ) ) ;
108+ printerMock . Verify ( mock => mock . PrintCommandUsage ( It . IsAny < ICommandLineCommand > ( ) ) , Times . Once ( ) ) ;
109109 }
110110
111111 [ Theory ]
@@ -123,41 +123,46 @@ public void CustomInvokedPrinterWorksCorrectly(string[] args, bool cmdPassed, bo
123123
124124 var parser = new CommandLineParser < UsagePrinterGetsCalledOptions > ( parserOptions ) ;
125125
126- parser . Printer = new UsagePrinter ( parserOptions , parser , builderMock . Object ) ;
126+ parser . Printer = new UsagePrinter ( parser , builderMock . Object ) ;
127127
128128 parser . AddCommand < UsagePrinterCommandOptions > ( )
129129 . Name ( "cmd" )
130130 . Required ( ) ;
131131
132132 var result = parser . Parse ( args ) ;
133133
134- builderMock . Verify ( mock => mock . Print ( ) , Times . Never ( ) ) ;
135- builderMock . Verify ( mock => mock . PrintCommand ( It . IsAny < string > ( ) , It . IsAny < ICommandLineCommandContainer > ( ) ) , Times . Never ( ) ) ;
136- builderMock . Verify ( mock => mock . PrintOption ( It . IsAny < ICommandLineOption > ( ) ) , Times . Never ( ) ) ;
134+ builderMock . Verify ( mock => mock . Build ( ) , Times . Never ( ) ) ;
135+ builderMock . Verify ( mock => mock . AddCommand ( It . IsAny < string > ( ) , It . IsAny < ICommandLineCommandContainer > ( ) ) , Times . Never ( ) ) ;
136+ builderMock . Verify ( mock => mock . AddOption ( It . IsAny < ICommandLineOption > ( ) ) , Times . Never ( ) ) ;
137137
138138 if ( result . HelpRequested )
139+ {
139140 parser . Printer . PrintUsage ( result . HelpRequestedFor ) ;
141+ }
140142
141143 if ( result . HasErrors )
142144 {
143145 foreach ( var err in result . Errors )
144146 {
145- if ( ! ( err is BaseParserException baseParserException ) ) continue ;
147+ if ( ! ( err is BaseParserException baseParserException ) )
148+ {
149+ continue ;
150+ }
146151
147152 parser . Printer . PrintUsage ( baseParserException . Argument ) ;
148153 }
149154 }
150155
151156 builderMock . Verify (
152- mock => mock . Print ( ) ,
157+ mock => mock . Build ( ) ,
153158 ToTimes ( result . HelpRequested || result . HasErrors ) ) ;
154159
155160 builderMock . Verify (
156- mock => mock . PrintCommand ( It . IsAny < string > ( ) , It . IsAny < ICommandLineCommandContainer > ( ) ) ,
161+ mock => mock . AddCommand ( It . IsAny < string > ( ) , It . IsAny < ICommandLineCommand > ( ) ) ,
157162 ToTimes ( cmdPassed ) ) ;
158163
159164 builderMock . Verify (
160- mock => mock . PrintOption ( It . IsAny < ICommandLineOption > ( ) ) ,
165+ mock => mock . AddOption ( It . IsAny < ICommandLineOption > ( ) ) ,
161166 ToTimes ( optPassed ) ) ;
162167 }
163168
0 commit comments