@@ -165,6 +165,47 @@ public static IResourceBuilder<T> AddInteractionCommands<T>(this IResourceBuilde
165165
166166 return CommandResults . Success ( ) ;
167167 } )
168+ . WithCommand ( "dismiss-interaction" , "Dismiss interaction tests" , executeCommand : commandContext =>
169+ {
170+ var interactionService = commandContext . ServiceProvider . GetRequiredService < IInteractionService > ( ) ;
171+
172+ RunInteractionWithDismissValues ( nameof ( IInteractionService . PromptNotificationAsync ) , ( showDismiss , title ) =>
173+ {
174+ return interactionService . PromptNotificationAsync (
175+ title : title ,
176+ message : string . Empty ,
177+ options : new NotificationInteractionOptions { ShowDismiss = showDismiss } ,
178+ cancellationToken : commandContext . CancellationToken ) ;
179+ } ) ;
180+ RunInteractionWithDismissValues ( nameof ( IInteractionService . PromptConfirmationAsync ) , ( showDismiss , title ) =>
181+ {
182+ return interactionService . PromptConfirmationAsync (
183+ title : title ,
184+ message : string . Empty ,
185+ options : new MessageBoxInteractionOptions { ShowDismiss = showDismiss } ,
186+ cancellationToken : commandContext . CancellationToken ) ;
187+ } ) ;
188+ RunInteractionWithDismissValues ( nameof ( IInteractionService . PromptMessageBoxAsync ) , ( showDismiss , title ) =>
189+ {
190+ return interactionService . PromptMessageBoxAsync (
191+ title : title ,
192+ message : string . Empty ,
193+ options : new MessageBoxInteractionOptions { ShowDismiss = showDismiss } ,
194+ cancellationToken : commandContext . CancellationToken ) ;
195+ } ) ;
196+ RunInteractionWithDismissValues ( nameof ( IInteractionService . PromptInputAsync ) , ( showDismiss , title ) =>
197+ {
198+ return interactionService . PromptInputAsync (
199+ title : title ,
200+ message : string . Empty ,
201+ inputLabel : "Input" ,
202+ placeHolder : "Enter input" ,
203+ options : new InputsDialogInteractionOptions { ShowDismiss = showDismiss } ,
204+ cancellationToken : commandContext . CancellationToken ) ;
205+ } ) ;
206+
207+ return Task . FromResult ( CommandResults . Success ( ) ) ;
208+ } )
168209 . WithCommand ( "many-values" , "Many values" , executeCommand : async commandContext =>
169210 {
170211 var interactionService = commandContext . ServiceProvider . GetRequiredService < IInteractionService > ( ) ;
@@ -202,6 +243,14 @@ public static IResourceBuilder<T> AddInteractionCommands<T>(this IResourceBuilde
202243
203244 return resource ;
204245 }
246+
247+ private static void RunInteractionWithDismissValues ( string title , Func < bool ? , string , Task > action )
248+ {
249+ // Don't wait for interactions to complete, i.e. await tasks.
250+ _ = action ( null , $ "{ title } - ShowDismiss = null") ;
251+ _ = action ( true , $ "{ title } - ShowDismiss = true") ;
252+ _ = action ( false , $ "{ title } - ShowDismiss = false") ;
253+ }
205254}
206255
207256#pragma warning restore ASPIREINTERACTION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
0 commit comments