public void LogWriterCanGetConfiguredCategories()
        {
            LogSource source = null;

            LogWriter logWriter = new LogWriterFactory().Create();

            try
            {
                foreach (string key in logWriter.TraceSources.Keys)
                {
                    logWriter.TraceSources.TryGetValue(key, out source);
                    Assert.IsNotNull(source, key);
                    Assert.AreEqual(key, source.Name);
                }

                source = null;
                logWriter.TraceSources.TryGetValue("AppTest", out source);
            }
            finally
            {
                logWriter.Dispose();
            }

            Assert.IsNotNull(source);
        }
        public void LogWriterCanGetConfiguredCategories()
        {
            LogSource source = null;

            LogWriter logWriter =
#if NETCOREAPP
                new LogWriterFactory(NetCoreHelper.LookupConfigSection).Create();
#else
                new LogWriterFactory().Create();
#endif

            try
            {
                foreach (string key in logWriter.TraceSources.Keys)
                {
                    logWriter.TraceSources.TryGetValue(key, out source);
                    Assert.IsNotNull(source, key);
                    Assert.AreEqual(key, source.Name);
                }

                source = null;
                logWriter.TraceSources.TryGetValue("AppTest", out source);
            }
            finally
            {
                logWriter.Dispose();
            }

            Assert.IsNotNull(source);
        }
        public void DisposedLogWriterCreatedThroughFactoryUnregistersHandler()
        {
            Assert.AreEqual(0, configurationSource.GetNotificationDelegates(LoggingSettings.SectionName).Length);

            LogWriter logWriter = new LogWriterFactory(configurationSource).Create();

            Assert.IsNotNull(logWriter);
            Assert.AreEqual(2, logWriter.TraceSources.Count);

            Assert.AreEqual(1, configurationSource.GetNotificationDelegates(LoggingSettings.SectionName).Length);

            logWriter.Dispose();

            Assert.AreEqual(0, configurationSource.GetNotificationDelegates(LoggingSettings.SectionName).Length);
        }
		public void DisposedLogWriterCreatedThroughFactoryUnregistersHandler()
		{
			Assert.AreEqual(0, configurationSource.GetNotificationDelegates(LoggingSettings.SectionName).Length);

			LogWriter logWriter = new LogWriterFactory(configurationSource).Create();
			Assert.IsNotNull(logWriter);
			Assert.AreEqual(2, logWriter.TraceSources.Count);

			Assert.AreEqual(1, configurationSource.GetNotificationDelegates(LoggingSettings.SectionName).Length);

			logWriter.Dispose();

			Assert.AreEqual(0, configurationSource.GetNotificationDelegates(LoggingSettings.SectionName).Length);
		}
        public void LogWriterCanGetConfiguredCategories()
        {
            LogSource source = null;

            LogWriter logWriter = new LogWriterFactory().Create();

            try
            {
                foreach (string key in logWriter.TraceSources.Keys)
                {
                    logWriter.TraceSources.TryGetValue(key, out source);
                    Assert.IsNotNull(source, key);
                    Assert.AreEqual(key, source.Name);
                }

                source = null;
                logWriter.TraceSources.TryGetValue("AppTest", out source);
            }
            finally
            {
                logWriter.Dispose();
            }

            Assert.IsNotNull(source);
        }