public void ToArrayTest()
        {
            AppenderCollection appenderCollection = new AppenderCollection();
            IAppender          appender           = new AppenderMemory();

            appenderCollection.Add(appender);

            IAppender[] appenderArray = appenderCollection.ToArray();

            Assert.AreEqual(1, appenderArray.Length);
            Assert.AreEqual(appender, appenderArray[0]);
        }
        public void ReadOnlyToArrayTest()
        {
            AppenderCollection appenderCollection = new AppenderCollection();
            IAppender          appender           = new AppenderMemory();

            appenderCollection.Add(appender);
            AppenderCollection readonlyAppenderCollection = AppenderCollection.ReadOnly(appenderCollection);

            IAppender[] appenderArray = readonlyAppenderCollection.ToArray();

            Assert.AreEqual(1, appenderArray.Length);
            Assert.AreEqual(appender, appenderArray[0]);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Attaches an appender.
 /// </summary>
 /// <param name="newAppender">The appender to add.</param>
 /// <remarks>
 /// <para>
 /// If the appender is already in the list it won't be added again.
 /// </para>
 /// </remarks>
 public void AddAppender(IAppender newAppender)
 {
     if (newAppender == null)
     {
         throw new ArgumentNullException("newAppender");
     }
     m_appenderArray = null;
     if (m_appenderList == null)
     {
         m_appenderList = new AppenderCollection(1);
     }
     if (!m_appenderList.Contains(newAppender))
     {
         m_appenderList.Add(newAppender);
     }
 }