@@ -79,7 +79,7 @@ public DestinationCommandTest()
79
79
_logger . Setup ( p => p . IsEnabled ( It . IsAny < LogLevel > ( ) ) ) . Returns ( true ) ;
80
80
}
81
81
82
- [ Fact ( DisplayName = "dst comand " ) ]
82
+ [ Fact ( DisplayName = "dst command " ) ]
83
83
public async Task Dst_Command ( )
84
84
{
85
85
var command = "dst" ;
@@ -90,7 +90,7 @@ public async Task Dst_Command()
90
90
Assert . Equal ( ExitCodes . Success , exitCode ) ;
91
91
}
92
92
93
- [ Fact ( DisplayName = "dst add comand " ) ]
93
+ [ Fact ( DisplayName = "dst add command " ) ]
94
94
public async Task DstAdd_Command ( )
95
95
{
96
96
var command = "dst add -n MyName -a MyAET -h MyHost -p 100" ;
@@ -124,7 +124,7 @@ public async Task DstAdd_Command()
124
124
It . IsAny < CancellationToken > ( ) ) , Times . Once ( ) ) ;
125
125
}
126
126
127
- [ Fact ( DisplayName = "dst add comand exception" ) ]
127
+ [ Fact ( DisplayName = "dst add command exception" ) ]
128
128
public async Task DstAdd_Command_Exception ( )
129
129
{
130
130
var command = "dst add -n MyName -a MyAET --apps App MyCoolApp TheApp" ;
@@ -141,7 +141,7 @@ public async Task DstAdd_Command_Exception()
141
141
_logger . VerifyLoggingMessageBeginsWith ( "Error creating DICOM destination" , LogLevel . Critical , Times . Once ( ) ) ;
142
142
}
143
143
144
- [ Fact ( DisplayName = "dst add comand configuration exception" ) ]
144
+ [ Fact ( DisplayName = "dst add command configuration exception" ) ]
145
145
public async Task DstAdd_Command_ConfigurationException ( )
146
146
{
147
147
var command = "dst add -n MyName -a MyAET --apps App MyCoolApp TheApp" ;
@@ -157,7 +157,7 @@ public async Task DstAdd_Command_ConfigurationException()
157
157
_logger . VerifyLoggingMessageBeginsWith ( "Please execute `testhost config init` to intialize Informatics Gateway." , LogLevel . Critical , Times . Once ( ) ) ;
158
158
}
159
159
160
- [ Fact ( DisplayName = "dst remove comand " ) ]
160
+ [ Fact ( DisplayName = "dst remove command " ) ]
161
161
public async Task DstRemove_Command ( )
162
162
{
163
163
var command = "dst rm -n MyName" ;
@@ -177,7 +177,7 @@ public async Task DstRemove_Command()
177
177
_informaticsGatewayClient . Verify ( p => p . DicomDestinations . Delete ( It . Is < string > ( o => o . Equals ( name ) ) , It . IsAny < CancellationToken > ( ) ) , Times . Once ( ) ) ;
178
178
}
179
179
180
- [ Fact ( DisplayName = "dst remove comand exception" ) ]
180
+ [ Fact ( DisplayName = "dst remove command exception" ) ]
181
181
public async Task DstRemove_Command_Exception ( )
182
182
{
183
183
var command = "dst rm -n MyName" ;
@@ -194,7 +194,7 @@ public async Task DstRemove_Command_Exception()
194
194
_logger . VerifyLoggingMessageBeginsWith ( "Error deleting DICOM destination" , LogLevel . Critical , Times . Once ( ) ) ;
195
195
}
196
196
197
- [ Fact ( DisplayName = "dst remove comand configuration exception" ) ]
197
+ [ Fact ( DisplayName = "dst remove command configuration exception" ) ]
198
198
public async Task DstRemove_Command_ConfigurationException ( )
199
199
{
200
200
var command = "dst rm -n MyName" ;
@@ -210,7 +210,7 @@ public async Task DstRemove_Command_ConfigurationException()
210
210
_logger . VerifyLoggingMessageBeginsWith ( "Please execute `testhost config init` to intialize Informatics Gateway." , LogLevel . Critical , Times . Once ( ) ) ;
211
211
}
212
212
213
- [ Fact ( DisplayName = "dst list comand " ) ]
213
+ [ Fact ( DisplayName = "dst list command " ) ]
214
214
public async Task DstList_Command ( )
215
215
{
216
216
var command = "dst list" ;
@@ -236,7 +236,7 @@ public async Task DstList_Command()
236
236
_informaticsGatewayClient . Verify ( p => p . DicomDestinations . List ( It . IsAny < CancellationToken > ( ) ) , Times . Once ( ) ) ;
237
237
}
238
238
239
- [ Fact ( DisplayName = "dst list comand exception" ) ]
239
+ [ Fact ( DisplayName = "dst list command exception" ) ]
240
240
public async Task DstList_Command_Exception ( )
241
241
{
242
242
var command = "dst list" ;
@@ -253,7 +253,7 @@ public async Task DstList_Command_Exception()
253
253
_logger . VerifyLoggingMessageBeginsWith ( "Error retrieving DICOM destinations" , LogLevel . Critical , Times . Once ( ) ) ;
254
254
}
255
255
256
- [ Fact ( DisplayName = "dst list comand configuration exception" ) ]
256
+ [ Fact ( DisplayName = "dst list command configuration exception" ) ]
257
257
public async Task DstList_Command_ConfigurationException ( )
258
258
{
259
259
var command = "dst list" ;
@@ -269,7 +269,7 @@ public async Task DstList_Command_ConfigurationException()
269
269
_logger . VerifyLoggingMessageBeginsWith ( "Please execute `testhost config init` to intialize Informatics Gateway." , LogLevel . Critical , Times . Once ( ) ) ;
270
270
}
271
271
272
- [ Fact ( DisplayName = "dst list comand empty" ) ]
272
+ [ Fact ( DisplayName = "dst list command empty" ) ]
273
273
public async Task DstList_Command_Empty ( )
274
274
{
275
275
var command = "dst list" ;
@@ -285,5 +285,58 @@ public async Task DstList_Command_Empty()
285
285
286
286
_logger . VerifyLogging ( "No DICOM destinations configured." , LogLevel . Warning , Times . Once ( ) ) ;
287
287
}
288
+
289
+ [ Fact ( DisplayName = "dst cecho command" ) ]
290
+ public async Task DstCEcho_Command ( )
291
+ {
292
+ var command = "dst cecho -n MyName" ;
293
+ var result = _paser . Parse ( command ) ;
294
+ Assert . Equal ( ExitCodes . Success , result . Errors . Count ) ;
295
+
296
+ var name = result . CommandResult . Children [ 0 ] . Tokens [ 0 ] . Value ;
297
+ Assert . Equal ( "MyName" , name ) ;
298
+
299
+ _informaticsGatewayClient . Setup ( p => p . DicomDestinations . Delete ( It . IsAny < string > ( ) , It . IsAny < CancellationToken > ( ) ) ) ;
300
+
301
+ int exitCode = await _paser . InvokeAsync ( command ) ;
302
+
303
+ Assert . Equal ( ExitCodes . Success , exitCode ) ;
304
+
305
+ _informaticsGatewayClient . Verify ( p => p . ConfigureServiceUris ( It . IsAny < Uri > ( ) ) , Times . Once ( ) ) ;
306
+ _informaticsGatewayClient . Verify ( p => p . DicomDestinations . CEcho ( It . Is < string > ( o => o . Equals ( name ) ) , It . IsAny < CancellationToken > ( ) ) , Times . Once ( ) ) ;
307
+ }
308
+
309
+ [ Fact ( DisplayName = "dst cecho command exception" ) ]
310
+ public async Task DstCEcho_Command_Exception ( )
311
+ {
312
+ var command = "dst cecho -n MyName" ;
313
+ _informaticsGatewayClient . Setup ( p => p . DicomDestinations . CEcho ( It . IsAny < string > ( ) , It . IsAny < CancellationToken > ( ) ) )
314
+ . Throws ( new Exception ( "error" ) ) ;
315
+
316
+ int exitCode = await _paser . InvokeAsync ( command ) ;
317
+
318
+ Assert . Equal ( ExitCodes . DestinationAe_ErrorCEcho , exitCode ) ;
319
+
320
+ _informaticsGatewayClient . Verify ( p => p . ConfigureServiceUris ( It . IsAny < Uri > ( ) ) , Times . Once ( ) ) ;
321
+ _informaticsGatewayClient . Verify ( p => p . DicomDestinations . CEcho ( It . IsAny < string > ( ) , It . IsAny < CancellationToken > ( ) ) , Times . Once ( ) ) ;
322
+
323
+ _logger . VerifyLoggingMessageBeginsWith ( "C-ECHO to MyName failed" , LogLevel . Critical , Times . Once ( ) ) ;
324
+ }
325
+
326
+ [ Fact ( DisplayName = "dst cecho command configuration exception" ) ]
327
+ public async Task DstCEcho_Command_ConfigurationException ( )
328
+ {
329
+ var command = "dst cecho -n MyName" ;
330
+ _configurationService . SetupGet ( p => p . IsInitialized ) . Returns ( false ) ;
331
+
332
+ int exitCode = await _paser . InvokeAsync ( command ) ;
333
+
334
+ Assert . Equal ( ExitCodes . Config_NotConfigured , exitCode ) ;
335
+
336
+ _informaticsGatewayClient . Verify ( p => p . ConfigureServiceUris ( It . IsAny < Uri > ( ) ) , Times . Never ( ) ) ;
337
+ _informaticsGatewayClient . Verify ( p => p . DicomDestinations . CEcho ( It . IsAny < string > ( ) , It . IsAny < CancellationToken > ( ) ) , Times . Never ( ) ) ;
338
+
339
+ _logger . VerifyLoggingMessageBeginsWith ( "Please execute `testhost config init` to intialize Informatics Gateway." , LogLevel . Critical , Times . Once ( ) ) ;
340
+ }
288
341
}
289
342
}
0 commit comments