protected override void PostDeserialize() { base.PostDeserialize(); // NOTE: if not already being called be the bootstrapper, use the // configuration being loaded as a default config at the // point it is being deserialized. var stackTrace = new System.Diagnostics.StackTrace(); if (!stackTrace.GetFrames().Any(stackFrame => stackFrame.GetMethod()?.DeclaringType?.FullName == typeof(SystemDiagnosticsBootstrapper).FullName)) { SystemDiagnosticsBootstrapper.Configure(this); } }
public void ConfigurationManager_GetSection_WillReturnSystemDiagnosticsSection() { var section = SystemDiagnosticsBootstrapper.Configure() as SystemDiagnosticsConfigurationSection; Assert.IsNotNull(section); // assert Assert.IsFalse(section.Assert.AssertUIEnabled); Assert.AreEqual("assert.log", section.Assert.LogFileName); // performanceCounters Assert.AreEqual(123456, section.PerfCounters.FileMappingSize); // sources Assert.AreEqual(4, section.Sources.Count); // trace Assert.AreEqual(true, section.Trace.AutoFlush); Assert.AreEqual(3, section.Trace.Listeners.Count); // sharedListeners Assert.AreEqual(4, section.SharedListeners.Count); }