@@ -209,4 +209,190 @@ public void SupportsAnsi_ReturnsTrue_WhenNonInteractiveTrue()
209209 // Assert
210210 Assert . True ( env . SupportsAnsi ) ;
211211 }
212+
213+ [ Fact ]
214+ public void SupportsInteractiveInput_ReturnsTrue_WhenPlaygroundModeSet ( )
215+ {
216+ // Arrange
217+ var configuration = new ConfigurationBuilder ( )
218+ . AddInMemoryCollection ( new Dictionary < string , string ? >
219+ {
220+ [ "ASPIRE_PLAYGROUND" ] = "true"
221+ } )
222+ . Build ( ) ;
223+
224+ // Act
225+ var env = new CliHostEnvironment ( configuration , nonInteractive : false ) ;
226+
227+ // Assert
228+ Assert . True ( env . SupportsInteractiveInput ) ;
229+ }
230+
231+ [ Fact ]
232+ public void SupportsInteractiveOutput_ReturnsTrue_WhenPlaygroundModeSet ( )
233+ {
234+ // Arrange
235+ var configuration = new ConfigurationBuilder ( )
236+ . AddInMemoryCollection ( new Dictionary < string , string ? >
237+ {
238+ [ "ASPIRE_PLAYGROUND" ] = "true"
239+ } )
240+ . Build ( ) ;
241+
242+ // Act
243+ var env = new CliHostEnvironment ( configuration , nonInteractive : false ) ;
244+
245+ // Assert
246+ Assert . True ( env . SupportsInteractiveOutput ) ;
247+ }
248+
249+ [ Fact ]
250+ public void SupportsInteractiveInput_ReturnsTrue_WhenPlaygroundModeSet_EvenInCI ( )
251+ {
252+ // Arrange - ASPIRE_PLAYGROUND should override CI environment detection
253+ var configuration = new ConfigurationBuilder ( )
254+ . AddInMemoryCollection ( new Dictionary < string , string ? >
255+ {
256+ [ "ASPIRE_PLAYGROUND" ] = "true" ,
257+ [ "CI" ] = "true"
258+ } )
259+ . Build ( ) ;
260+
261+ // Act
262+ var env = new CliHostEnvironment ( configuration , nonInteractive : false ) ;
263+
264+ // Assert
265+ Assert . True ( env . SupportsInteractiveInput ) ;
266+ }
267+
268+ [ Fact ]
269+ public void SupportsInteractiveOutput_ReturnsTrue_WhenPlaygroundModeSet_EvenInCI ( )
270+ {
271+ // Arrange - ASPIRE_PLAYGROUND should override CI environment detection
272+ var configuration = new ConfigurationBuilder ( )
273+ . AddInMemoryCollection ( new Dictionary < string , string ? >
274+ {
275+ [ "ASPIRE_PLAYGROUND" ] = "true" ,
276+ [ "GITHUB_ACTIONS" ] = "true"
277+ } )
278+ . Build ( ) ;
279+
280+ // Act
281+ var env = new CliHostEnvironment ( configuration , nonInteractive : false ) ;
282+
283+ // Assert
284+ Assert . True ( env . SupportsInteractiveOutput ) ;
285+ }
286+
287+ [ Fact ]
288+ public void SupportsInteractiveInput_ReturnsTrue_WhenPlaygroundModeSet_ButNonInteractiveIsTrue ( )
289+ {
290+ // Arrange - ASPIRE_PLAYGROUND should take precedence over --non-interactive flag
291+ var configuration = new ConfigurationBuilder ( )
292+ . AddInMemoryCollection ( new Dictionary < string , string ? >
293+ {
294+ [ "ASPIRE_PLAYGROUND" ] = "true"
295+ } )
296+ . Build ( ) ;
297+
298+ // Act
299+ var env = new CliHostEnvironment ( configuration , nonInteractive : true ) ;
300+
301+ // Assert
302+ // ASPIRE_PLAYGROUND takes precedence over the --non-interactive flag
303+ Assert . True ( env . SupportsInteractiveInput ) ;
304+ }
305+
306+ [ Fact ]
307+ public void SupportsInteractiveOutput_ReturnsTrue_WhenPlaygroundModeSet_ButNonInteractiveIsTrue ( )
308+ {
309+ // Arrange - ASPIRE_PLAYGROUND should take precedence over --non-interactive flag
310+ var configuration = new ConfigurationBuilder ( )
311+ . AddInMemoryCollection ( new Dictionary < string , string ? >
312+ {
313+ [ "ASPIRE_PLAYGROUND" ] = "true"
314+ } )
315+ . Build ( ) ;
316+
317+ // Act
318+ var env = new CliHostEnvironment ( configuration , nonInteractive : true ) ;
319+
320+ // Assert
321+ // ASPIRE_PLAYGROUND takes precedence over the --non-interactive flag
322+ Assert . True ( env . SupportsInteractiveOutput ) ;
323+ }
324+
325+ [ Fact ]
326+ public void SupportsInteractiveInput_ReturnsFalse_WhenPlaygroundModeSetToFalse ( )
327+ {
328+ // Arrange
329+ var configuration = new ConfigurationBuilder ( )
330+ . AddInMemoryCollection ( new Dictionary < string , string ? >
331+ {
332+ [ "ASPIRE_PLAYGROUND" ] = "false" ,
333+ [ "CI" ] = "true"
334+ } )
335+ . Build ( ) ;
336+
337+ // Act
338+ var env = new CliHostEnvironment ( configuration , nonInteractive : false ) ;
339+
340+ // Assert
341+ Assert . False ( env . SupportsInteractiveInput ) ;
342+ }
343+
344+ [ Fact ]
345+ public void SupportsAnsi_ReturnsTrue_WhenPlaygroundModeSet ( )
346+ {
347+ // Arrange
348+ var configuration = new ConfigurationBuilder ( )
349+ . AddInMemoryCollection ( new Dictionary < string , string ? >
350+ {
351+ [ "ASPIRE_PLAYGROUND" ] = "true"
352+ } )
353+ . Build ( ) ;
354+
355+ // Act
356+ var env = new CliHostEnvironment ( configuration , nonInteractive : false ) ;
357+
358+ // Assert
359+ Assert . True ( env . SupportsAnsi ) ;
360+ }
361+
362+ [ Fact ]
363+ public void SupportsAnsi_ReturnsTrue_WhenPlaygroundModeSet_EvenWithNO_COLOR ( )
364+ {
365+ // Arrange - ASPIRE_PLAYGROUND should override NO_COLOR
366+ var configuration = new ConfigurationBuilder ( )
367+ . AddInMemoryCollection ( new Dictionary < string , string ? >
368+ {
369+ [ "ASPIRE_PLAYGROUND" ] = "true" ,
370+ [ "NO_COLOR" ] = "1"
371+ } )
372+ . Build ( ) ;
373+
374+ // Act
375+ var env = new CliHostEnvironment ( configuration , nonInteractive : false ) ;
376+
377+ // Assert
378+ Assert . True ( env . SupportsAnsi ) ;
379+ }
380+
381+ [ Fact ]
382+ public void SupportsAnsi_ReturnsTrue_WhenPlaygroundModeSet_WithNonInteractive ( )
383+ {
384+ // Arrange - ASPIRE_PLAYGROUND should enable ANSI even with --non-interactive
385+ var configuration = new ConfigurationBuilder ( )
386+ . AddInMemoryCollection ( new Dictionary < string , string ? >
387+ {
388+ [ "ASPIRE_PLAYGROUND" ] = "true"
389+ } )
390+ . Build ( ) ;
391+
392+ // Act
393+ var env = new CliHostEnvironment ( configuration , nonInteractive : true ) ;
394+
395+ // Assert
396+ Assert . True ( env . SupportsAnsi ) ;
397+ }
212398}
0 commit comments