예제 #1
0
        public void CanCreateLog4NetConfigUsingStream()
        {
            Log4netFactory factory;

            using (var stream = StringToStream(log4netXml))
            {
                factory = new Log4netFactory(stream);
            }

            var logger = factory.Create(loggerName);

            logger.Debug(logMessage);

            var logContent = GetLogContent();

            Assert.AreEqual(logMessage, logContent);
        }
예제 #2
0
        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            containerRegistry.RegisterSingleton <IMemoryCache>(_ => new MemoryCache(new MemoryCacheOptions()));
            containerRegistry.RegisterSingleton <ILogger>(_ =>
            {
                var factory = new Log4netFactory();
                return(factory.Create("app"));
            });

            containerRegistry.RegisterSingleton <ITest, Test1>()
            .InterceptAsync <ITest, CacheInterceptor>()
            .InterceptAsync <ITest, LogInterceptor>();

            containerRegistry.RegisterDialog <PrintPdfView>();
            containerRegistry.RegisterDialog <PrintPdf2View>();
            containerRegistry.RegisterDialog <ComboBoxView>();

            //containerRegistry.Intercept<ITest, ExceptionInterceptor>();
            //containerRegistry.Intercept<ITest, LoggingInterceptor>();
            //containerRegistry.InterceptAsync<ITest, AsyncMethodLogInterceptor>();

            //containerRegistry.InterceptAsync<ITest, LogInterceptor>();
            //containerRegistry.InterceptAsync<ITest, CacheInterceptor>();
        }