public override TraceListener Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
		{
			XmlTraceListenerData castedObjectConfiguration
				= (XmlTraceListenerData)objectConfiguration;
			XmlTraceListener createdObject
				= new XmlTraceListener(castedObjectConfiguration.FileName);
			return createdObject;
		}
            public SendToXmlTraceListenerBuilder(ILoggingConfigurationSendTo context, string listenerName)
                :base(context)
            {
                xmlTraceListener = new XmlTraceListenerData
                {
                    Name = listenerName
                };

                base.AddTraceListenerToSettingsAndCategory(xmlTraceListener);
            }
        public void CanCreatePoliciesForXmlTraceListener()
        {
            XmlTraceListenerData listenerData = new XmlTraceListenerData("listener", "test.log");
            listenerData.TraceOutputOptions = TraceOptions.Callstack | TraceOptions.ProcessId;
            listenerData.Filter = SourceLevels.Error;
            loggingSettings.TraceListeners.Add(listenerData);

            using (var container = CreateContainer())
            {
                var wrapper = (ReconfigurableTraceListenerWrapper)container.Resolve<TraceListener>("listener");
                XmlTraceListener createdObject = (XmlTraceListener) wrapper.InnerTraceListener;

                Assert.IsNotNull(createdObject);
                Assert.AreEqual(listenerData.TraceOutputOptions, createdObject.TraceOutputOptions);
                Assert.IsNotNull(createdObject.Filter);
                Assert.IsInstanceOfType(createdObject.Filter, typeof(EventTypeFilter));
                Assert.AreEqual(listenerData.Filter, ((EventTypeFilter)createdObject.Filter).EventType);
                Assert.AreEqual(listenerData.FileName, Path.GetFileName(((FileStream)((StreamWriter)createdObject.Writer).BaseStream).Name));
            }
        }
 public void WhenCreatingInstanceUsingDefaultContructor_ThenListenerDataTypeIsSet()
 {
     var listener = new XmlTraceListenerData();
     Assert.AreEqual(typeof(XmlTraceListenerData), listener.ListenerDataType);
 }