public void Factories_SubstituteLoggerFactory_GetLoggerNameListTest()
        {
            SubstituteLoggerFactory target = new SubstituteLoggerFactory();
            string         name            = "foo";
            IList <string> actual;

            actual = target.GetLoggerNameList();
            Assert.AreEqual(0, actual.Count);

            target.GetLogger(name).Debug("test 1");

            actual = target.GetLoggerNameList();
            Assert.AreEqual(1, actual.Count);
            Assert.AreEqual(name, actual[0]);

            name = "bar";
            target.GetLogger(name).Debug("test 2");

            actual = target.GetLoggerNameList();
            Assert.AreEqual(2, actual.Count);
            Assert.AreEqual(name, actual[1]);
        }
예제 #2
0
        private static void EmitSubstituteLoggerWarning()
        {
            var loggerNameList = _tempFactory.GetLoggerNameList();

            if (loggerNameList.Length == 0)
            {
                return;
            }

            var msg = "The following loggers will not work because the were created during the default configuration phase of the underlying logging system: "
                      + string.Join(", ", loggerNameList);

            EventLogHelper.WriteEntry(msg, null);
        }