public void TraceListenerNodeDefaultValues()
        {
            TraceListenerReferenceNode traceListenerReference = new TraceListenerReferenceNode();

            Assert.AreEqual("TraceListener Reference", traceListenerReference.Name);
            Assert.IsNull(traceListenerReference.ReferencedTraceListener);
        }
		private void AddTraceListeners(ConfigurationNode node, TraceSourceData data)
		{
			foreach (TraceListenerReferenceData refData in data.TraceListeners)
			{
				TraceListenerReferenceNode referenceNode = new TraceListenerReferenceNode(refData);
				foreach(TraceListenerNode listenerNode in listeners.Nodes)
				{
					if (listenerNode.Name == referenceNode.Name)
					{
						referenceNode.ReferencedTraceListener = listenerNode;
					}
				}
				node.AddNode(referenceNode);
			}			
		}
        public void TraceListenerNameEqualsReferencedTraceListenerName()
        {
            string traceListenerName = "a traceListener";

            TraceListenerReferenceNode traceListenerReference = new TraceListenerReferenceNode();

            TraceListenerCollectionNode traceListenerCollection = new TraceListenerCollectionNode();
            TraceListenerNode aTraceListener = new WmiTraceListenerNode(new WmiTraceListenerData(traceListenerName));

            ApplicationNode.AddNode(traceListenerReference);
            ApplicationNode.AddNode(traceListenerCollection);
            traceListenerCollection.AddNode(aTraceListener);

            traceListenerReference.ReferencedTraceListener = aTraceListener;

            Assert.AreEqual(traceListenerName, traceListenerReference.Name);
        }
 private void CreateTraceSourceNode(TraceSourceData traceSourceData)
 {
     CategoryTraceSourceNode traceSourceNode = new CategoryTraceSourceNode(traceSourceData);
     foreach (TraceListenerReferenceData traceListener in traceSourceData.TraceListeners)
     {
         TraceListenerReferenceNode referenceNode = new TraceListenerReferenceNode(traceListener);
         foreach (TraceListenerNode traceListenerNode in listeners.Nodes)
         {
             if (traceListenerNode.Name == referenceNode.Name)
             {
                 referenceNode.ReferencedTraceListener = traceListenerNode;
             }
         }
         traceSourceNode.AddNode(referenceNode);
     }
     node.AddNode(traceSourceNode);
 }
        /// <summary>
        /// Adds the <see cref="LoggingSettingsNode"/> and adds the default nodes.
        /// </summary>
        /// <param name="node">The <see cref="LoggingSettingsNode"/> added.</param>
        protected override void ExecuteCore(ConfigurationNode node)
        {
            base.ExecuteCore(node);
			LoggingSettingsNode loggingNode = ChildNode as LoggingSettingsNode;
			if (loggingNode == null) return;

            TextFormatterNode defaultTextFormatterNode = new TextFormatterNode();
            FormattedEventLogTraceListenerNode defaultTraceListenerNode = new FormattedEventLogTraceListenerNode();
            CategoryTraceSourceNode generalCategoryNode = new CategoryTraceSourceNode(new TraceSourceData(Resources.TraceSourceCategoryGeneral, SourceLevels.All));

			loggingNode.AddNode(new LogFilterCollectionNode());

			CategoryTraceSourceCollectionNode categoryTraceSourcesNode = new CategoryTraceSourceCollectionNode();
			TraceListenerReferenceNode generalCategoryListenerRef = new TraceListenerReferenceNode(new TraceListenerReferenceData(defaultTraceListenerNode.Name));
			categoryTraceSourcesNode.AddNode(generalCategoryNode);
			generalCategoryNode.AddNode(generalCategoryListenerRef);
			generalCategoryListenerRef.ReferencedTraceListener = defaultTraceListenerNode;
			loggingNode.AddNode(categoryTraceSourcesNode);			
			
			SpecialTraceSourcesNode specialTraceSourcesNode = new SpecialTraceSourcesNode();			
			ErrorsTraceSourceNode errorsTraceSourcesNode = new ErrorsTraceSourceNode(new TraceSourceData());
            TraceListenerReferenceNode errorsTraceListenerReferenceNode = new TraceListenerReferenceNode();
			errorsTraceSourcesNode.AddNode(errorsTraceListenerReferenceNode);
			errorsTraceListenerReferenceNode.ReferencedTraceListener = defaultTraceListenerNode;
			specialTraceSourcesNode.AddNode(errorsTraceSourcesNode);
			specialTraceSourcesNode.AddNode(new NotProcessedTraceSourceNode(new TraceSourceData()));
			specialTraceSourcesNode.AddNode(new AllTraceSourceNode(new TraceSourceData()));
			loggingNode.AddNode(specialTraceSourcesNode);

			TraceListenerCollectionNode traceListenerCollectionNode = new TraceListenerCollectionNode();
			traceListenerCollectionNode.AddNode(defaultTraceListenerNode);
			defaultTraceListenerNode.Formatter = defaultTextFormatterNode;
			loggingNode.AddNode(traceListenerCollectionNode);

			FormatterCollectionNode formattersNode = new FormatterCollectionNode();
			formattersNode.AddNode(defaultTextFormatterNode);
			loggingNode.AddNode(formattersNode);


            loggingNode.DefaultCategory = generalCategoryNode;
            loggingNode.LogWarningWhenNoCategoriesMatch = true;
			loggingNode.TracingEnabled = true;

            ServiceHelper.GetUIService(serviceProvider).RefreshPropertyGrid();
        }