public void CanDeserializeSerializedWithAutoFlushConfiguration() { string name = "name"; bool autoFlush = false; TraceSourceData data = new TraceSourceData(name, SourceLevels.Critical, false); data.TraceListeners.Add(new TraceListenerReferenceData("listener1")); data.TraceListeners.Add(new TraceListenerReferenceData("listener2")); LoggingSettings settings = new LoggingSettings(); settings.TraceSources.Add(data); IDictionary<string, ConfigurationSection> sections = new Dictionary<string, ConfigurationSection>(); sections[LoggingSettings.SectionName] = settings; IConfigurationSource configurationSource = ConfigurationTestHelper.SaveSectionsInFileAndReturnConfigurationSource(sections); LoggingSettings roSettigs = (LoggingSettings)configurationSource.GetSection(LoggingSettings.SectionName); Assert.AreEqual(1, roSettigs.TraceSources.Count); Assert.IsNotNull(roSettigs.TraceSources.Get(name)); Assert.AreEqual(SourceLevels.Critical, roSettigs.TraceSources.Get(name).DefaultLevel); Assert.AreEqual(autoFlush, roSettigs.TraceSources.Get(name).AutoFlush); Assert.AreEqual(2, roSettigs.TraceSources.Get(name).TraceListeners.Count); Assert.IsNotNull(roSettigs.TraceSources.Get(name).TraceListeners.Get("listener1")); Assert.IsNotNull(roSettigs.TraceSources.Get(name).TraceListeners.Get("listener2")); }
public void ClientSettingsDataTest() { DistributionStrategyDataCollection distStrategies = new DistributionStrategyDataCollection(); DistributionStrategyData distData = new InProcDistributionStrategyData(); distData.Name = "Test"; distStrategies.Add(distData); LoggingSettings settings = new LoggingSettings(); settings.CategoryFilterMode = CategoryFilterMode.DenyAllExceptAllowed; settings.CategoryFilters = new CategoryFilterDataCollection(); foreach (DistributionStrategyData distributionStrategyData in distStrategies) { settings.DistributionStrategies.Add(distributionStrategyData); } settings.LoggingEnabled = true; settings.MinimumPriority = 0; settings.TracingEnabled = true; ClientSettingsNode node = new ClientSettingsNode(settings); GeneratedApplicationNode.Nodes.Add(node); Assert.AreEqual(CategoryFilterMode.DenyAllExceptAllowed, node.CategoryFilterSettings.CategoryFilterMode); Assert.AreEqual(0, node.CategoryFilterSettings.CategoryFilters.Count); Assert.AreEqual(true, node.LoggingEnabled); Assert.AreEqual(0, node.MinimumPriority); Assert.AreEqual(true, node.TracingEnabled); LoggingSettings nodeData = node.LoggingSettings; Assert.AreEqual(CategoryFilterMode.DenyAllExceptAllowed, nodeData.CategoryFilterMode); Assert.AreEqual(0, nodeData.CategoryFilters.Count); Assert.AreEqual("Test", nodeData.DistributionStrategies["Test"].Name); Assert.AreEqual(true, nodeData.LoggingEnabled); Assert.AreEqual(0, nodeData.MinimumPriority); Assert.AreEqual(true, nodeData.TracingEnabled); }
public void SetUp() { provider = new LoggingSettingsManageabilityProvider(new Dictionary<Type, ConfigurationElementManageabilityProvider>(0)); machineKey = new MockRegistryKey(true); userKey = new MockRegistryKey(true); section = new LoggingSettings(); configurationSource = new DictionaryConfigurationSource(); configurationSource.Add(LoggingSettings.SectionName, section); }
public void SettingsAreCorrectWhenConfiguringLoggingStarts() { LoggingSettings settings = GetLoggingSettings(); Assert.IsNotNull(settings); Assert.IsFalse(settings.LogWarningWhenNoCategoriesMatch); Assert.IsFalse(settings.TracingEnabled); Assert.IsFalse(settings.RevertImpersonation); }
public void WhenCreatingListener_ThenThrows() { var settings = new LoggingSettings { Formatters = { new TextFormatterData { Name = "formatter", Template = "template" } } }; this.listenerData.BuildTraceListener(settings); }
public void Should_contain_Console_targets_if_printing_to_console() { var loggingSettings = new LoggingSettings("Test", true); LoggingConfigurator.ConfigureLogging(loggingSettings); var logConfiguration = NLog.LogManager.Configuration; Assert.IsNotEmpty(logConfiguration.LoggingRules.Where(rule => rule.Targets.Any(target => target is ColoredConsoleTarget))); }
public AuditIngestionFaultPolicy(IDocumentStore store, LoggingSettings settings, Func <FailedTransportMessage, object> messageBuilder, Func <string, Exception, Task> onCriticalError) { this.store = store; this.logPath = Path.Combine(settings.LogPath, @"FailedImports\Audit"); this.messageBuilder = messageBuilder; failureCircuitBreaker = new ImportFailureCircuitBreaker(onCriticalError); Directory.CreateDirectory(logPath); }
public void TearDown() { System.Configuration.Configuration rwConfiguration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); LoggingSettings rwSettings = rwConfiguration.GetSection(LoggingSettings.SectionName) as LoggingSettings; ((CategoryFilterData)rwSettings.LogFilters.Get("Category")).CategoryFilters.Remove("MockCategoryOne"); rwConfiguration.Save(); ConfigurationManager.RefreshSection(LoggingSettings.SectionName); ConfigurationChangeWatcher.ResetDefaultPollDelay(); }
[ExcludeFromCodeCoverage] // wf debug logging public static string GetDirectoryPath(LoggingSettings loggingSettings) { var dirPath = loggingSettings.LogFileDirectory; if (String.IsNullOrWhiteSpace(dirPath)) { dirPath = GetDefaultLogDirectoryPath(); } return(dirPath); }
protected override TraceListener CoreBuildTraceListener(LoggingSettings settings) { return(new RollingXmlTraceListener( FileName, RollSizeKB, TimeStampPattern, RollFileExistsBehavior, RollInterval, MaxArchivedFiles)); }
public void then_file_has_overridden_values() { FileConfigurationSource source = new FileConfigurationSource(TargetFile); LoggingSettings settings = (LoggingSettings)source.GetSection(LoggingSettings.SectionName); FormattedEventLogTraceListenerData traceListener = (FormattedEventLogTraceListenerData)settings.TraceListeners.Get("Event Log Listener"); Assert.AreEqual(TraceOptions.ProcessId, traceListener.TraceOutputOptions); Assert.AreEqual("overridden source", traceListener.Source); Assert.AreEqual("overridden machine", traceListener.MachineName); }
/// <summary> /// Creates node with specified configuration data. /// </summary> /// <param name="loggingSettings">The specified configuration data.</param> public ClientSettingsNode(LoggingSettings loggingSettings) : base() { if (loggingSettings == null) { throw new ArgumentNullException("loggingSettings"); } this.onDistributionStrategyNodeRemoved = new ConfigurationNodeChangedEventHandler(OnDistributionStrategyNodeRemoved); this.onDistributionStrategyNodeRenamed = new ConfigurationNodeChangedEventHandler(OnDistributionStrategyNodeRenamed); this.loggingSettings = loggingSettings; }
/// <summary> /// Initializes a new instance of a <see cref="LoggingConfigurationView"/> object based on the specified <see cref="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings"/>. /// </summary> /// <param name="loggingSettings">The configuration data for the Logging Application Block.</param> public LoggingConfigurationView(LoggingSettings loggingSettings) { Guard.ArgumentNotNull(loggingSettings, "loggingSettings"); this.loggingSettings = loggingSettings; ApplyDefaultGlobalSettings(); ApplyDefaultFormatters(); ApplyDefaultTraceListener(); }
private static ILoggingSettings GetSettingsObject(IEnumerable <IWorkflowDescriptor> workflows = null) { var settings = new LoggingSettings("InvalidUri"); if (workflows != null) { workflows.ToList().ForEach(wf => settings.Workflows.Add(wf)); } return(settings); }
public void SetUp() { loggingSettings = new LoggingSettings(); connectionStringsSection = new ConnectionStringsSection(); configurationSource = new DictionaryConfigurationSource(); configurationSource.Add(LoggingSettings.SectionName, loggingSettings); configurationSource.Add("connectionStrings", connectionStringsSection); container = new UnityContainer(); container.AddExtension(new EnterpriseLibraryCoreExtension(configurationSource)); }
protected override TraceListenerData GetConfiguration(string name, IConfigurationSource configurationSource) { LoggingSettings settings = LoggingSettings.GetLoggingSettings(configurationSource); ValidateSettings(settings); TraceListenerData objectConfiguration = settings.TraceListeners.Get(name); ValidateConfiguration(objectConfiguration, name); return(objectConfiguration); }
/// <summary> /// <para>Adds to the dictionary configuration data for /// the enterpriselibrary.configurationSettings configuration section.</para> /// </summary> /// <param name="serviceProvider"> /// <para>The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</para> /// </param> /// <param name="configurationDictionary"> /// <para>A <see cref="ConfigurationDictionary"/> to add /// configuration data to.</para></param> public override void BuildContext(IServiceProvider serviceProvider, ConfigurationDictionary configurationDictionary) { ClientSettingsNode node = GetClientSettingsNode(serviceProvider); if (node != null) { LoggingSettings settings = node.LoggingSettings; configurationDictionary[LoggingSettings.SectionName] = settings; } }
public System.Configuration.ConfigurationSection GetSection(string sectionName) { if (sectionName.Equals("loggingConfiguration", StringComparison.CurrentCulture)) { var loggingSettings = new LoggingSettings(); loggingSettings.DefaultCategory = GENERAL; loggingSettings.TracingEnabled = true; loggingSettings.LogWarningWhenNoCategoriesMatch = true; var msgTemplate = GetMessageTemplate(); var performanceTemplate = GetPerformanceTemplate(); var msgFormatter = GetMessageFormatter(msgTemplate); loggingSettings.Formatters.Add(msgFormatter); var performanceFormatter = GetPerformanceFormatter(performanceTemplate); loggingSettings.Formatters.Add(performanceFormatter); var infoListenerRef = new TraceListenerReferenceData(INFO); var verboseListenerRef = new TraceListenerReferenceData(VERBOSE); var warningListenerRef = new TraceListenerReferenceData(WARNING); var errorListenerRef = new TraceListenerReferenceData(ERROR); var performanceListenerRef = new TraceListenerReferenceData(PERFORMANCE); var consoleListenerRef = new TraceListenerReferenceData(CONSOLE); loggingSettings.TraceListeners.Add(GetInfoListener()); loggingSettings.TraceListeners.Add(GetVerboseListener()); loggingSettings.TraceListeners.Add(GetWarningListener()); loggingSettings.TraceListeners.Add(GetErrorListener()); loggingSettings.TraceListeners.Add(GetPerformanceListener()); loggingSettings.TraceListeners.Add(GetConsoleListener()); loggingSettings.TraceSources.Add(GetGeneralCategory(infoListenerRef, verboseListenerRef, consoleListenerRef)); loggingSettings.TraceSources.Add(GetInfoCategory(infoListenerRef, consoleListenerRef)); loggingSettings.TraceSources.Add(GetVerboseCategory(verboseListenerRef, consoleListenerRef)); loggingSettings.TraceSources.Add(GetWarningCategory(warningListenerRef, consoleListenerRef)); loggingSettings.TraceSources.Add(GetErrorCategory(errorListenerRef, consoleListenerRef)); loggingSettings.TraceSources.Add(GetPerformanceCategory(performanceListenerRef)); // Special Sources loggingSettings.SpecialTraceSources.AllEventsTraceSource.Name = "AllEvents"; loggingSettings.SpecialTraceSources.AllEventsTraceSource.DefaultLevel = SourceLevels.All; loggingSettings.SpecialTraceSources.NotProcessedTraceSource.Name = "NotProcessed"; loggingSettings.SpecialTraceSources.NotProcessedTraceSource.DefaultLevel = SourceLevels.All; loggingSettings.SpecialTraceSources.ErrorsTraceSource.Name = "LoggingErrorsAndWarnings"; loggingSettings.SpecialTraceSources.ErrorsTraceSource.DefaultLevel = SourceLevels.All; loggingSettings.SpecialTraceSources.ErrorsTraceSource.TraceListeners.Clear(); loggingSettings.SpecialTraceSources.ErrorsTraceSource.TraceListeners.Add(errorListenerRef); return(loggingSettings); } return(null); }
public void ConfigurationIsCorrectWhenConfiguringLoggingWithEventLog() { const string ListenerName = "Event Log Listener"; const string FormatterName = "Text Formatter"; const string Template = "My template"; const string LogName = "LogName"; const string MachineName = "MachineName"; const string EventSource = "EventSource"; configurationStart.LogToCategoryNamed(CategoryName) .WithOptions .DoNotAutoFlushEntries() .SetAsDefaultCategory() .ToSourceLevels(SourceLevels.ActivityTracing) .SendTo .EventLog(ListenerName) .ToLog(LogName) .ToMachine(MachineName) .UsingEventLogSource(EventSource) .Filter(SourceLevels.Verbose) .FormatWith(new FormatterBuilder() .TextFormatterNamed(FormatterName) .UsingTemplate(Template)); LoggingSettings settings = GetLoggingSettings(); Assert.IsNotNull(settings); Assert.AreEqual(LoggingFixtureBase.CategoryName, settings.DefaultCategory); Assert.AreEqual(1, settings.TraceSources.Count); var traceSource = settings.TraceSources.Get(0); Assert.IsFalse(traceSource.AutoFlush); Assert.AreEqual(SourceLevels.ActivityTracing, traceSource.DefaultLevel); Assert.AreEqual(ListenerName, traceSource.TraceListeners.Get(0).Name); Assert.AreEqual(1, settings.TraceListeners.Count); var eventLogListener = settings.TraceListeners.Get(0) as FormattedEventLogTraceListenerData; Assert.IsNotNull(eventLogListener); Assert.AreEqual(ListenerName, eventLogListener.Name); Assert.AreEqual(LogName, eventLogListener.Log); Assert.AreEqual(MachineName, eventLogListener.MachineName); Assert.AreEqual(EventSource, eventLogListener.Source); Assert.AreEqual(SourceLevels.Verbose, eventLogListener.Filter); Assert.AreEqual(TraceOptions.None, eventLogListener.TraceOutputOptions); Assert.AreEqual(FormatterName, eventLogListener.Formatter); Assert.AreEqual(1, settings.Formatters.Count); var formatter = settings.Formatters.Get(FormatterName) as TextFormatterData; Assert.IsNotNull(formatter); Assert.AreEqual(Template, formatter.Template); }
public void ConfigurationIsCorrectWhenConfiguringLoggingWithDatabaseWithDefaultValues() { const string ListenerName = "Database Listener"; const string FormatterName = "Text Formatter"; const string Template = "My template"; const string DatabaseName = "local"; const string DefaultAddSProc = "AddCategory"; const string DefaultWriteSProc = "WriteLog"; configurationStart.LogToCategoryNamed(CategoryName) .WithOptions .DoNotAutoFlushEntries() .SetAsDefaultCategory() .ToSourceLevels(SourceLevels.ActivityTracing) .SendTo .Database(ListenerName) .UseDatabase(DatabaseName) .WithTraceOptions(TraceOptions.DateTime) .Filter(SourceLevels.Verbose) .FormatWith(new FormatterBuilder() .TextFormatterNamed(FormatterName) .UsingTemplate(Template)); LoggingSettings settings = GetLoggingSettings(); Assert.IsNotNull(settings); Assert.AreEqual(LoggingFixtureBase.CategoryName, settings.DefaultCategory); Assert.AreEqual(1, settings.TraceSources.Count); var traceSource = settings.TraceSources.Get(0); Assert.IsFalse(traceSource.AutoFlush); Assert.AreEqual(SourceLevels.ActivityTracing, traceSource.DefaultLevel); Assert.AreEqual(ListenerName, traceSource.TraceListeners.Get(0).Name); Assert.AreEqual(1, settings.TraceListeners.Count); var databaseListener = settings.TraceListeners.Get(0) as FormattedDatabaseTraceListenerData; Assert.IsNotNull(databaseListener); Assert.AreEqual(ListenerName, databaseListener.Name); Assert.AreEqual(DatabaseName, databaseListener.DatabaseInstanceName); Assert.AreEqual(DefaultWriteSProc, databaseListener.WriteLogStoredProcName); Assert.AreEqual(DefaultAddSProc, databaseListener.AddCategoryStoredProcName); Assert.AreEqual(SourceLevels.Verbose, databaseListener.Filter); Assert.AreEqual(TraceOptions.DateTime, databaseListener.TraceOutputOptions); Assert.AreEqual(FormatterName, databaseListener.Formatter); Assert.AreEqual(1, settings.Formatters.Count); var formatter = settings.Formatters.Get(FormatterName) as TextFormatterData; Assert.IsNotNull(formatter); Assert.AreEqual(Template, formatter.Template); }
public void ConfigurationIsCorrectWhenConfiguringLoggingWithFlatFile() { const string FilePath = "sample.log"; const string ListenerName = "Flat File Listener"; const string FormatterName = "Text Formatter"; const string Template = "My template"; const string Footer = "Footer"; const string Header = "Header"; configurationStart.LogToCategoryNamed(CategoryName) .WithOptions .DoNotAutoFlushEntries() .SetAsDefaultCategory() .ToSourceLevels(SourceLevels.ActivityTracing) .SendTo .FlatFile(ListenerName) .ToFile(FilePath) .WithFooter(Footer) .WithHeader(Header) .WithTraceOptions(TraceOptions.None) .FormatWith(new FormatterBuilder() .TextFormatterNamed(FormatterName) .UsingTemplate(Template)); LoggingSettings settings = GetLoggingSettings(); Assert.IsNotNull(settings); Assert.AreEqual(LoggingFixtureBase.CategoryName, settings.DefaultCategory); Assert.AreEqual(1, settings.TraceSources.Count); var traceSource = settings.TraceSources.Get(0); Assert.IsFalse(traceSource.AutoFlush); Assert.AreEqual(SourceLevels.ActivityTracing, traceSource.DefaultLevel); Assert.AreEqual(ListenerName, traceSource.TraceListeners.Get(0).Name); Assert.AreEqual(1, settings.TraceListeners.Count); var flatFile = settings.TraceListeners.Get(0) as FlatFileTraceListenerData; Assert.IsNotNull(flatFile); Assert.AreEqual(ListenerName, flatFile.Name); Assert.AreEqual(FilePath, flatFile.FileName); Assert.AreEqual(Footer, flatFile.Footer); Assert.AreEqual(Header, flatFile.Header); Assert.AreEqual(TraceOptions.None, flatFile.TraceOutputOptions); Assert.AreEqual(FormatterName, flatFile.Formatter); Assert.AreEqual(1, settings.Formatters.Count); var formatter = settings.Formatters.Get(FormatterName) as TextFormatterData; Assert.IsNotNull(formatter); Assert.AreEqual(Template, formatter.Template); }
/// <inheritdoc /> public LoggerFactoryArguments( ILogger logger, ISecretsProvider secretsProvider, LoggingSettings loggingSettings) { Contract.RequiresNotNull(logger); Logger = logger; LoggingSettings = loggingSettings; SecretsProvider = secretsProvider; }
public void CanCreateInstanceFromConfigurationFile() { LoggingSettings loggingSettings = new LoggingSettings(); loggingSettings.TraceListeners.Add(new SystemDiagnosticsTraceListenerData("listener", typeof(EventLogTraceListener), "Entlib Tests")); TraceListener listener = TraceListenerCustomFactory.Instance.Create(context, "listener", CommonUtil.SaveSectionsAndGetConfigurationSource(loggingSettings), reflectionCache); Assert.IsNotNull(listener); Assert.AreEqual(listener.GetType(), typeof(EventLogTraceListener)); Assert.AreEqual("Entlib Tests", ((EventLogTraceListener)listener).EventLog.Source); }
public void TearDown() { System.Configuration.Configuration rwConfiguration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); LoggingSettings rwSettings = rwConfiguration.GetSection(LoggingSettings.SectionName) as LoggingSettings; ((CategoryFilterData)rwSettings.LogFilters.Get("Category")).CategoryFilters.Remove("MockCategoryOne"); rwConfiguration.Save(); ConfigurationManager.RefreshSection(LoggingSettings.SectionName); EnterpriseLibraryContainer.Current = null; }
/// <summary> /// Test a log entry to see is greater than or equal to the minimum priority. /// </summary> /// <param name="log">Log entry to test.</param> /// <returns>Returns true if the log entry passes through the category filter.</returns> public bool Filter(LogEntry log) { LoggingSettings settings = loggingConfigurationView.GetLoggingSettings(); int minPriority = settings.MinimumPriority; if (log.Priority < 0) { log.Priority = minPriority; } return(log.Priority >= minPriority); }
private void SendMessage(LogEntry logEntry) { ContextItems items = new ContextItems(); items.ProcessContextItems(logEntry); LoggingSettings settings = loggingConfigurationView.GetLoggingSettings(); LogDistributionStrategyFactory factory = new LogDistributionStrategyFactory(this.loggingConfigurationView.ConfigurationContext); ILogDistributionStrategy strategy = factory.CreateDistributionStrategy(settings.DistributionStrategy); strategy.SendLog(logEntry); }
public void SetUp() { instrumentationSettings = new InstrumentationConfigurationSection(true, true, false); loggingSettings = new LoggingSettings(); configurationSource = new DictionaryConfigurationSource(); configurationSource.Add(LoggingSettings.SectionName, loggingSettings); container = new UnityContainer(); container.AddExtension(new EnterpriseLibraryCoreExtension(configurationSource)); }
public void CanCreateInstanceFromConfigurationFile() { LoggingSettings loggingSettings = new LoggingSettings(); loggingSettings.TraceListeners.Add( new WmiTraceListenerData("listener")); TraceListener listener = TraceListenerCustomFactory.Instance.Create(context, "listener", CommonUtil.SaveSectionsAndGetConfigurationSource(loggingSettings), reflectionCache); Assert.IsNotNull(listener); Assert.AreEqual(listener.GetType(), typeof(WmiTraceListener)); }
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { var loggingSettings = new LoggingSettings(); Configuration.GetSection("ApplicationInsights").Bind(loggingSettings); loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); loggerFactory.AddApplicationInsightsLogger(loggingSettings); app.UseMvc(); }
public static void GenerateWmiObjects(LoggingSettings configurationObject, ICollection <ConfigurationSetting> wmiSettings) { wmiSettings.Add( new LoggingBlockSetting( configurationObject, configurationObject.DefaultCategory, configurationObject.LogWarningWhenNoCategoriesMatch, configurationObject.TracingEnabled, configurationObject.RevertImpersonation)); }
protected override void OnStart(string[] args) { var busConfiguration = new BusConfiguration(); busConfiguration.AssembliesToScan(AllAssemblies.Except("ServiceControl.Plugin")); var loggingSettings = new LoggingSettings(ServiceName); bootstrapper = new Bootstrapper(Stop, new Settings(ServiceName), busConfiguration, loggingSettings); bootstrapper.Start(); }
protected internal static void AddFormattersPart(AdmContentBuilder contentBuilder, String formatterName, IConfigurationSource configurationSource) { LoggingSettings configurationSection = (LoggingSettings)configurationSource.GetSection(LoggingSettings.SectionName); contentBuilder.AddDropDownListPartForNamedElementCollection <FormatterData>(Resources.TraceListenerFormatterPartName, FormatterPropertyName, configurationSection.Formatters, formatterName, true); }
public void CreatingInstanceWithEmptyQueuePathThrows() { var settings = new LoggingSettings() { Formatters = { new BinaryLogFormatterData("formatter") } }; new MsmqTraceListenerData() { QueuePath = "", Formatter = "formatter" }.BuildTraceListener(settings); }
public void WhenCreatingListener_ThenCreatesEmailListener() { var settings = new LoggingSettings { Formatters = { new TextFormatterData { Name = "formatter", Template = "template" } } }; var listener = (EmailTraceListener)listenerData.BuildTraceListener(settings); Assert.IsNotNull(listener); Assert.AreEqual("listener", listener.Name); Assert.AreEqual(TraceOptions.DateTime | TraceOptions.Callstack, listener.TraceOutputOptions); Assert.IsNotNull(listener.Filter); Assert.AreEqual(SourceLevels.Warning, ((EventTypeFilter)listener.Filter).EventType); Assert.IsInstanceOfType(listener.Formatter, typeof(TextFormatter)); }
public LoggingSettings Build() { loggingSettings = new LoggingSettings(loggingSettingsNode.Name, loggingSettingsNode.TracingEnabled, loggingSettingsNode.DefaultCategory == null ? string.Empty : loggingSettingsNode.DefaultCategory.Name); loggingSettings.LogWarningWhenNoCategoriesMatch = loggingSettingsNode.LogWarningWhenNoCategoriesMatch; BuilFormatters(); BuildLogFilters(); BuildTraceListeners(); BuildTraceSources(); BuildSpecialTraceSources(); return loggingSettings; }
public void WhenCreatingListener_ThenCreatesMsmqListener() { var settings = new LoggingSettings { Formatters = { new BinaryLogFormatterData { Name = "formatter" } } }; var listener = (MsmqTraceListener)listenerData.BuildTraceListener(settings); Assert.IsNotNull(listener); Assert.AreEqual("listener", listener.Name); Assert.AreEqual(TraceOptions.DateTime | TraceOptions.Callstack, listener.TraceOutputOptions); Assert.IsNotNull(listener.Filter); Assert.AreEqual(SourceLevels.Warning, ((EventTypeFilter)listener.Filter).EventType); Assert.IsInstanceOfType(listener.Formatter, typeof(BinaryLogFormatter)); Assert.AreEqual("queue path", listener.QueuePath); }
public void WhenCreatingListener_ThenCreatesFileListenerWithoutFormatter() { var settings = new LoggingSettings { Formatters = { new TextFormatterData { Name = "formatter", Template = "template" } } }; var listener = (FlatFileTraceListener)listenerData.BuildTraceListener(settings); try { Assert.IsNotNull(listener); Assert.AreEqual("listener", listener.Name); Assert.AreEqual(TraceOptions.DateTime | TraceOptions.Callstack, listener.TraceOutputOptions); Assert.IsNotNull(listener.Filter); Assert.AreEqual(SourceLevels.Warning, ((EventTypeFilter)listener.Filter).EventType); Assert.IsNull(listener.Formatter); Assert.AreEqual("filename", Path.GetFileName(((FileStream)((StreamWriter)listener.Writer).BaseStream).Name)); } finally { listener.Dispose(); } }
public XhtmlTraceListener(string FileName, LoggingSettings LS) : base(FileName, LS.Settings.LogVerbose) { mTraceStatus = new TraceStatus(LS.XHTMLLinesLabel, null, null, false, FileName, conXhtml); }
/// <summary> /// Initializes a new instance of the <see cref="LogUtility"/> class. /// </summary> /// <param name="productName">Name of the product.</param> /// <param name="outputFolder">The output folder. Pass empty string or null to log to executable directory</param> /// <param name="extension">The extension for the log file - leading dot is optional (e.g 'log', '.errors' or '.trc'). /// Pass empty string or null for default extension</param> /// <param name="level">The MINIMUM level of logging to be included in the output.</param> /// <param name="mode">The log writing mode.</param> /// <exception cref="ArgumentNullException">Thrown if the product name is null or empty</exception> /// <exception cref="PathTooLongException">Thrown if the log file path will exceed the maximum path length</exception> public static LogUtility CreateLogger(string productName, string outputFolder, string extension, LogLevel level, LogMode mode) { #region Implementation LogUtility logger = null; lock (_settings) { // Get the location of the executable, set that to our output Directory if (String.IsNullOrEmpty(outputFolder)) { outputFolder = Application.StartupPath; } //default to the custom folder string tempRoot = string.IsNullOrEmpty(outputFolder) ? Environment.CurrentDirectory : outputFolder; tempRoot = Path.Combine(tempRoot, LOG_ROOT); string source = Path.Combine(tempRoot, CustomFolder); Exception settingsError = null; bool noCustomSetting = false; LoggingSettings settings = null; //if there is no folder, use the application folder if (!Directory.Exists(source)) { source = Application.StartupPath; noCustomSetting = true; } string settingsFile = (Path.Combine(source, SETTINGS_FILE)); //load existing settings if (File.Exists(settingsFile)) { try { //update the mode & level from the saved settings settings = LoggingSettings.DeserializeFromFile(settingsFile); if (noCustomSetting) { //if there is no customised setting, overwrite the application //default with the settings requested by the caller settings.LoggingLevel = level; settings.LoggingMode = mode; } else { //if there are customised settings, overwrite the caller's settings //with those from the customised settings file level = settings.LoggingLevel; mode = settings.LoggingMode; } } catch (System.Runtime.Serialization.SerializationException error) { settingsError = error; } } //read in the max log size from the settings file or use the default if not available //int maxSize = settings != null ? settings.MaxLogSize : _maxSize; //create the logger logger = new LogUtility(productName, outputFolder, extension, _maxSize, level, mode); //if settings was found but could not be loaded, inform user if (settingsError != null) { logger.AddException(string.Format("Error reading logging settings from {0}", source), settingsError); } //save the current settings for the user source = Path.Combine(tempRoot, CustomFolder); //only write the settings if the user had permissions to create a custom folder if (Directory.Exists(source) && (settings == null || noCustomSetting)) { settingsFile = (Path.Combine(source, SETTINGS_FILE)); settings = new LoggingSettings { LoggingLevel = level, LoggingMode = mode }; settings.SerializeToFile(settingsFile); } } return logger; #endregion }
public void ManageabilityProviderGeneratesProperAdmContent() { DictionaryConfigurationSource configurationSource = new DictionaryConfigurationSource(); LoggingSettings section = new LoggingSettings(); configurationSource.Add(LoggingSettings.SectionName, section); MockAdmContentBuilder contentBuilder = new MockAdmContentBuilder(); contentBuilder.StartCategory("category"); provider.AddAdministrativeTemplateDirectives(contentBuilder, configurationObject, configurationSource, "TestApp"); contentBuilder.EndCategory(); MockAdmContent content = contentBuilder.GetMockContent(); IEnumerator<AdmCategory> categoriesEnumerator = content.Categories.GetEnumerator(); categoriesEnumerator.MoveNext(); IEnumerator<AdmPolicy> policiesEnumerator = categoriesEnumerator.Current.Policies.GetEnumerator(); Assert.IsTrue(policiesEnumerator.MoveNext()); IEnumerator<AdmPart> partsEnumerator = policiesEnumerator.Current.Parts.GetEnumerator(); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmEditTextPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(EmailTraceListenerDataManageabilityProvider.FromAddressPropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmEditTextPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(EmailTraceListenerDataManageabilityProvider.ToAddressPropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmNumericPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(EmailTraceListenerDataManageabilityProvider.SmtpPortPropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmEditTextPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(EmailTraceListenerDataManageabilityProvider.SmtpServerPropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmEditTextPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(EmailTraceListenerDataManageabilityProvider.SubjectLineStarterPropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmEditTextPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(EmailTraceListenerDataManageabilityProvider.SubjectLineEnderPropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmTextPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.IsNull(partsEnumerator.Current.ValueName); // trace output options checkboxes Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNotNull(partsEnumerator.Current.KeyName); Assert.AreEqual("LogicalOperationStack", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNotNull(partsEnumerator.Current.KeyName); Assert.AreEqual("DateTime", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNotNull(partsEnumerator.Current.KeyName); Assert.AreEqual("Timestamp", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNotNull(partsEnumerator.Current.KeyName); Assert.AreEqual("ProcessId", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNotNull(partsEnumerator.Current.KeyName); Assert.AreEqual("ThreadId", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNotNull(partsEnumerator.Current.KeyName); Assert.AreEqual("Callstack", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmDropDownListPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(EmailTraceListenerDataManageabilityProvider.FilterPropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmDropDownListPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(EmailTraceListenerDataManageabilityProvider.FormatterPropertyName, partsEnumerator.Current.ValueName); Assert.IsFalse(partsEnumerator.MoveNext()); Assert.IsFalse(policiesEnumerator.MoveNext()); }
public void ManageabilityProviderGeneratesProperAdmContent() { DictionaryConfigurationSource configurationSource = new DictionaryConfigurationSource(); LoggingSettings section = new LoggingSettings(); configurationSource.Add(LoggingSettings.SectionName, section); section.TraceSources.Add(new TraceSourceData("source1", SourceLevels.Off)); section.TraceSources.Add(new TraceSourceData("source2", SourceLevels.Off)); MockAdmContentBuilder contentBuilder = new MockAdmContentBuilder(); contentBuilder.StartCategory("category"); provider.AddAdministrativeTemplateDirectives(contentBuilder, configurationObject, configurationSource, "TestApp"); contentBuilder.EndCategory(); MockAdmContent content = contentBuilder.GetMockContent(); IEnumerator<AdmCategory> categoriesEnumerator = content.Categories.GetEnumerator(); categoriesEnumerator.MoveNext(); IEnumerator<AdmPolicy> policiesEnumerator = categoriesEnumerator.Current.Policies.GetEnumerator(); Assert.IsTrue(policiesEnumerator.MoveNext()); IEnumerator<AdmPart> partsEnumerator = policiesEnumerator.Current.Parts.GetEnumerator(); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmDropDownListPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(CategoryFilterDataManageabilityProvider.CategoryFilterModePropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmTextPart), partsEnumerator.Current.GetType()); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsTrue(partsEnumerator.Current.KeyName.EndsWith(CategoryFilterDataManageabilityProvider.CategoryFiltersKeyName)); Assert.AreEqual("source1", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsTrue(partsEnumerator.Current.KeyName.EndsWith(CategoryFilterDataManageabilityProvider.CategoryFiltersKeyName)); Assert.AreEqual("source2", partsEnumerator.Current.ValueName); Assert.IsFalse(partsEnumerator.MoveNext()); Assert.IsFalse(policiesEnumerator.MoveNext()); }
public void ManageabilityProviderGeneratesProperAdmContent() { DictionaryConfigurationSource configurationSource = new DictionaryConfigurationSource(); LoggingSettings section = new LoggingSettings(); configurationSource.Add(LoggingSettings.SectionName, section); configurationObject.Type = typeof(object); configurationObject.Attributes.Add("name1", "valu;e1"); configurationObject.Attributes.Add("name2", "value2"); MockAdmContentBuilder contentBuilder = new MockAdmContentBuilder(); contentBuilder.StartCategory("category"); provider.AddAdministrativeTemplateDirectives(contentBuilder, configurationObject, configurationSource, "TestApp"); contentBuilder.EndCategory(); MockAdmContent content = contentBuilder.GetMockContent(); IEnumerator<AdmCategory> categoriesEnumerator = content.Categories.GetEnumerator(); categoriesEnumerator.MoveNext(); IEnumerator<AdmPolicy> policiesEnumerator = categoriesEnumerator.Current.Policies.GetEnumerator(); Assert.IsTrue(policiesEnumerator.MoveNext()); IEnumerator<AdmPart> partsEnumerator = policiesEnumerator.Current.Parts.GetEnumerator(); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmEditTextPart), partsEnumerator.Current.GetType()); Assert.AreEqual(CustomTraceListenerDataManageabilityProvider.ProviderTypePropertyName, partsEnumerator.Current.ValueName); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(typeof(object).AssemblyQualifiedName, ((AdmEditTextPart)partsEnumerator.Current).DefaultValue); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmEditTextPart), partsEnumerator.Current.GetType()); Assert.AreEqual(CustomTraceListenerDataManageabilityProvider.AttributesPropertyName, partsEnumerator.Current.ValueName); Assert.IsNull(partsEnumerator.Current.KeyName); IDictionary<String, String> attributes = new Dictionary<String, String>(); KeyValuePairParser.ExtractKeyValueEntries(((AdmEditTextPart)partsEnumerator.Current).DefaultValue, attributes); Assert.AreEqual(2, attributes.Count); Assert.AreEqual("valu;e1", attributes["name1"]); Assert.AreEqual("value2", attributes["name2"]); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmEditTextPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(CustomTraceListenerDataManageabilityProvider.InitDataPropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmTextPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.IsNull(partsEnumerator.Current.ValueName); // trace output options checkboxes Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNotNull(partsEnumerator.Current.KeyName); Assert.AreEqual("LogicalOperationStack", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNotNull(partsEnumerator.Current.KeyName); Assert.AreEqual("DateTime", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNotNull(partsEnumerator.Current.KeyName); Assert.AreEqual("Timestamp", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNotNull(partsEnumerator.Current.KeyName); Assert.AreEqual("ProcessId", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNotNull(partsEnumerator.Current.KeyName); Assert.AreEqual("ThreadId", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNotNull(partsEnumerator.Current.KeyName); Assert.AreEqual("Callstack", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmDropDownListPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(CustomTraceListenerDataManageabilityProvider.FilterPropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmDropDownListPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(CustomTraceListenerDataManageabilityProvider.FormatterPropertyName, partsEnumerator.Current.ValueName); Assert.IsFalse(partsEnumerator.MoveNext()); Assert.IsFalse(policiesEnumerator.MoveNext()); }
public void WhenCreatingListenerWithNoFormatterAvailable_ThenThrows() { var settings = new LoggingSettings { Formatters = { } }; listenerData.BuildTraceListener(settings); }
public WikiTraceListener(string fileName, LoggingSettings ls) : base(ls.Settings, new TraceStatus(ls.WikiLinesLabel, ls.WikiLinesSinceUploadLabel, ls.UploadsCountLabel, ls.Settings.UploadYN, fileName, conWiki)) { }
public XhtmlTraceListener(string fileName, LoggingSettings ls) : base(fileName, ls.Settings.LogVerbose) { mTraceStatus = new TraceStatus(ls.XHTMLLinesLabel, null, null, false, fileName, ConXhtml); }
public void Init() { loggingSettings = SchemaBuilder.GetLoggingSettings(); }
public void ManageabilityProviderGeneratesProperAdmContent() { // need to set these because their default values are null. configurationObject.Formatter = "formatter"; configurationObject.QueuePath = "path"; DictionaryConfigurationSource configurationSource = new DictionaryConfigurationSource(); LoggingSettings section = new LoggingSettings(); configurationSource.Add(LoggingSettings.SectionName, section); MockAdmContentBuilder contentBuilder = new MockAdmContentBuilder(); contentBuilder.StartCategory("category"); provider.AddAdministrativeTemplateDirectives(contentBuilder, configurationObject, configurationSource, "TestApp"); contentBuilder.EndCategory(); MockAdmContent content = contentBuilder.GetMockContent(); IEnumerator<AdmCategory> categoriesEnumerator = content.Categories.GetEnumerator(); categoriesEnumerator.MoveNext(); IEnumerator<AdmPolicy> policiesEnumerator = categoriesEnumerator.Current.Policies.GetEnumerator(); Assert.IsTrue(policiesEnumerator.MoveNext()); IEnumerator<AdmPart> partsEnumerator = policiesEnumerator.Current.Parts.GetEnumerator(); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmEditTextPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(MsmqTraceListenerDataManageabilityProvider.QueuePathPropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmDropDownListPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(MsmqTraceListenerDataManageabilityProvider.MessagePriorityPropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmEditTextPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(MsmqTraceListenerDataManageabilityProvider.TimeToBeReceivedPropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmEditTextPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(MsmqTraceListenerDataManageabilityProvider.TimeToReachQueuePropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(MsmqTraceListenerDataManageabilityProvider.RecoverablePropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmDropDownListPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(MsmqTraceListenerDataManageabilityProvider.TransactionTypePropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(MsmqTraceListenerDataManageabilityProvider.UseAuthenticationPropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(MsmqTraceListenerDataManageabilityProvider.UseDeadLetterQueuePropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(MsmqTraceListenerDataManageabilityProvider.UseEncryptionPropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmTextPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.IsNull(partsEnumerator.Current.ValueName); // trace output options checkboxes Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNotNull(partsEnumerator.Current.KeyName); Assert.AreEqual("LogicalOperationStack", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNotNull(partsEnumerator.Current.KeyName); Assert.AreEqual("DateTime", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNotNull(partsEnumerator.Current.KeyName); Assert.AreEqual("Timestamp", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNotNull(partsEnumerator.Current.KeyName); Assert.AreEqual("ProcessId", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNotNull(partsEnumerator.Current.KeyName); Assert.AreEqual("ThreadId", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmCheckboxPart), partsEnumerator.Current.GetType()); Assert.IsNotNull(partsEnumerator.Current.KeyName); Assert.AreEqual("Callstack", partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmDropDownListPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(MsmqTraceListenerDataManageabilityProvider.FilterPropertyName, partsEnumerator.Current.ValueName); Assert.IsTrue(partsEnumerator.MoveNext()); Assert.AreSame(typeof(AdmDropDownListPart), partsEnumerator.Current.GetType()); Assert.IsNull(partsEnumerator.Current.KeyName); Assert.AreEqual(MsmqTraceListenerDataManageabilityProvider.FormatterPropertyName, partsEnumerator.Current.ValueName); Assert.IsFalse(partsEnumerator.MoveNext()); Assert.IsFalse(policiesEnumerator.MoveNext()); }