public void Initialize_Context_Wihtout_IViewStateWatcher_Logs_Error() { LogLevelTarget llt = new LogLevelTarget(); parentContext.AddLogTarget(llt); llt.ERROR += (LogLevelTarget.LogEventDelegate) delegate(object source, object message, object[] messageParams) { Assert.Pass(); }; parentContext.Install <SupportParentFinderExtension> (); parentContext.Install <ModularityExtension> (); parentContext.Initialize(); Assert.Fail(); }
public void Initialize_Context_Should_Work() { IContext context = new Context(); context.Install <SupportParentFinderExtension> (); context.Install <TestSupportViewStateWatcherExtension> (); context.Install <ModularityExtension> (); LogLevelTarget llt = new LogLevelTarget(); context.AddLogTarget(llt); llt.ERROR += (LogLevelTarget.LogEventDelegate) delegate(object source, object message, object[] messageParams) { Assert.Fail(); }; context.Configure(new ContextView(root)); }
public void Initialize_Context_Withought_Context_View_Thows_Error() { IContext context = new Context(); LogLevelTarget llt = new LogLevelTarget(); int errorCount = 0; context.AddLogTarget(llt); llt.ERROR += (LogLevelTarget.LogEventDelegate) delegate(object source, object message, object[] messageParams) { errorCount++; Assert.That(message, Contains.Substring("no contextview").IgnoreCase); }; context.Install <ModularityExtension> (); context.Initialize(); Assert.That(errorCount, Is.EqualTo(1)); }
public void Install_ModularityExtension_Before_IViewStateWatcher_Will_Error() { IContext context = new Context(); context.Install <SupportParentFinderExtension> (); context.Install <ModularityExtension> (); context.Install <TestSupportViewStateWatcherExtension> (); LogLevelTarget llt = new LogLevelTarget(); context.AddLogTarget(llt); llt.ERROR += (LogLevelTarget.LogEventDelegate) delegate(object source, object message, object[] messageParams) { Console.WriteLine(message); Assert.That(message, Is.StringContaining("IViewStateWatcher installed prior to Modularity").IgnoreCase); Assert.Pass(); }; context.Configure(new ContextView(root)); Assert.Fail(); }