public void PatternLayoutConverterProperties()
        {
            XmlDocument log4netConfig = new XmlDocument();

            log4netConfig.LoadXml(@"
                <log4net>
                  <appender name=""StringAppender"" type=""UnitTestProject1.Appender.StringAppender, UnitTestProject1"">
                    <layout type=""log4net.Layout.PatternLayout"">
                        <converter>
                            <name value=""propertyKeyCount"" />
                            <type value=""UnitTestProject1.Util.PropertyKeyCountPatternLayoutConverter, UnitTestProject1"" />
                            <property>
                                <key value=""one-plus-one"" />
                                <value value=""2"" />
                            </property>
                            <property>
                               <key value=""two-plus-two"" />
                               <value value=""4"" />
                            </property> 
                        </converter>
                        <conversionPattern value=""%propertyKeyCount"" />
                    </layout>
                  </appender>
                  <root>
                    <level value=""ALL"" />                  
                    <appender-ref ref=""StringAppender"" />
                  </root>  
                </log4net>");

            ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString());

            XmlConfigurator.Configure(rep, log4netConfig["log4net"]);

            ILog log = LogManager.GetLogger(rep.Name, "PatternLayoutConverterProperties");

            log.Debug("Message");

            PropertyKeyCountPatternLayoutConverter converter = PropertyKeyCountPatternLayoutConverter.MostRecentInstance;

            Assert.AreEqual(2, converter.Properties.Count);
            Assert.AreEqual("4", converter.Properties["two-plus-two"]);

            StringAppender appender = (StringAppender)LogManager.GetRepository(rep.Name).GetAppenders()[0];

            Assert.AreEqual("2", appender.GetString());
        }
 public PropertyKeyCountPatternLayoutConverter()
 {
     mostRecentInstance = this;
 }