@@ -244,6 +244,48 @@ public void Configure_QuickPulse_NullByDefault()
244
244
Assert . Null ( options . QuickPulseAuthenticationApiKey ) ;
245
245
}
246
246
247
+ [ Theory ]
248
+ [ InlineData ( null , true ) ] // default value
249
+ [ InlineData ( "true" , true ) ]
250
+ [ InlineData ( "false" , false ) ]
251
+ public void Configure_EnableLiveMetrics ( string value , bool expectedValue )
252
+ {
253
+ IConfiguration config = new ConfigurationBuilder ( )
254
+ . AddInMemoryCollection ( new Dictionary < string , string >
255
+ {
256
+ { "EnableLiveMetrics" , value } ,
257
+ } )
258
+ . Build ( ) ;
259
+
260
+ ApplicationInsightsLoggerOptionsSetup setup = new ApplicationInsightsLoggerOptionsSetup ( new MockLoggerConfiguration ( config ) , _environment ) ;
261
+
262
+ ApplicationInsightsLoggerOptions options = new ApplicationInsightsLoggerOptions ( ) ;
263
+ setup . Configure ( options ) ;
264
+
265
+ Assert . Equal ( expectedValue , options . EnableLiveMetrics ) ;
266
+ }
267
+
268
+ [ Theory ]
269
+ [ InlineData ( null , false ) ] // default value
270
+ [ InlineData ( "true" , true ) ]
271
+ [ InlineData ( "false" , false ) ]
272
+ public void Configure_EnableLiveMetricsFilters ( string value , bool expectedValue )
273
+ {
274
+ IConfiguration config = new ConfigurationBuilder ( )
275
+ . AddInMemoryCollection ( new Dictionary < string , string >
276
+ {
277
+ { "EnableLiveMetricsFilters" , value } ,
278
+ } )
279
+ . Build ( ) ;
280
+
281
+ ApplicationInsightsLoggerOptionsSetup setup = new ApplicationInsightsLoggerOptionsSetup ( new MockLoggerConfiguration ( config ) , _environment ) ;
282
+
283
+ ApplicationInsightsLoggerOptions options = new ApplicationInsightsLoggerOptions ( ) ;
284
+ setup . Configure ( options ) ;
285
+
286
+ Assert . Equal ( expectedValue , options . EnableLiveMetricsFilters ) ;
287
+ }
288
+
247
289
private class MockLoggerConfiguration : ILoggerProviderConfiguration < ApplicationInsightsLoggerProvider >
248
290
{
249
291
public MockLoggerConfiguration ( IConfiguration configuration )
0 commit comments