public void TestThreadSafety()
        {
            ILoggerController rep = LogManager.CreateController(Guid.NewGuid().ToString());
            var memoryAppender    = new AppenderMemory();
            var patternLayout     = new LayoutPattern();

            memoryAppender.Layout = patternLayout;
            memoryAppender.Activate();
            BasicConfig.Config(rep, memoryAppender);

            cThreadsRunning = cThreadsMax;
            var threads = Enumerable.Range(0, cThreadsMax)
                          .Select(i => new Thread(LogMessages(rep.Name)))
                          .ToList();

            foreach (var thread in threads)
            {
                thread.Start();
            }

            long cEventsRead = 0;

            while (cThreadsRunning > 0)
            {
                var events = memoryAppender.PopAllInputs();
                cEventsRead += events.Length;
            }
            foreach (var thread in threads)
            {
                thread.Join();
            }
            cEventsRead += memoryAppender.PopAllInputs().Length;
            Assert.AreEqual(cEventsExpected, cEventsRead, "Log events were lost.");
        }
        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]);
        }