public void Initialize_Context_Wihtout_IParentFinder_Logs_Error()
        {
            LogLevelTarget llt = new LogLevelTarget();

            parentContext.AddLogTarget(llt);
            llt.ERROR += (LogLevelTarget.LogEventDelegate) delegate(object source, object message, object[] messageParams) {
                Assert.Pass();
            };
            parentContext.Install <TestSupportViewStateWatcherExtension> ();
            parentContext.Install <ModularityExtension> ();
            parentContext.Initialize();
            Assert.Fail();
        }
        public void Extension_Logs_Error_When_Context_Initialized_With_No_ContextView()
        {
            bool errorLogged            = false;
            CallbackLogTarget logTarget = new CallbackLogTarget(delegate(LogParams result) {
                if (result.level == LogLevel.ERROR && result.source.GetType() == typeof(ModularityExtension))
                {
                    errorLogged = true;
                }
            });

            childContext.Install(typeof(ModularityExtension)).Install(typeof(SupportParentFinderExtension));
            childContext.AddLogTarget(logTarget);
            childContext.Initialize();
            Assert.That(errorLogged, Is.True);
        }
        public void addChild_logs_warning_unless_child_is_uninitialized()
        {
            LogParams?warning = null;

            context.AddLogTarget(new CallbackLogTarget(
                                     delegate(LogParams log) {
                if (log.level == LogLevel.WARN)
                {
                    warning = log;
                }
            }));
            Context child = new Context();

            child.Initialize();
            context.AddChild(child);
            Assert.That(warning, Is.Not.Null);
            Assert.That(warning.Value.message, Is.StringContaining("must be uninitialized"));
            Assert.That(warning.Value.messageParameters, Is.EqualTo(new object[] { child }).AsCollection);
        }
        public void extension_logs_error_when_context_initialized_with_no_contextView()
        {
            bool errorLogged            = false;
            CallbackLogTarget logTarget = new CallbackLogTarget(delegate(LogParams log) {
                if (log.source is ContextViewExtension && log.level == LogLevel.ERROR)
                {
                    errorLogged = true;
                }
            });

            context.Install <ContextViewExtension>();
            context.AddLogTarget(logTarget);
            context.Initialize();
            Assert.That(errorLogged, Is.True);
        }
 public void Extend(IContext context)
 {
     context.AddLogTarget(new ConsoleLogTarget(context));
 }
        /*============================================================================*/
        /* Public Functions                                                           */
        /*============================================================================*/

        public void Extend(IContext context)
        {
            context.AddLogTarget(this);
            context.injector.MappingOverride += MappingOverrideHandler;
        }
예제 #7
0
 public void Extend(IContext context)
 {
     context.AddLogTarget(new DebugLogTarget(context));
 }
		public void Extend (IContext context)
		{
			context.AddLogTarget(new DebugLogTarget(context));
		}
		/*============================================================================*/
		/* Public Functions                                                           */
		/*============================================================================*/

		public void Extend (IContext context)
		{
			context.AddLogTarget (this);
			context.injector.MappingOverride += MappingOverrideHandler;
		}
		public void Extend (IContext context)
		{
			context.AddLogTarget(new ConsoleLogTarget(context));
		}