protected RunInModuleResultContext ( PortalRequestContext portalContext, |
||
portalContext | PortalRequestContext | |
moduleResult | ||
action | System.Action | |
Résultat | void |
public void RunInModuleContext_Runs_Provided_Action() { // Arrange HttpContextBase httpContext = Mockery.CreateMockHttpContext(); ModuleRequestResult moduleResult = new ModuleRequestResult(); PortalRequestContext portalContext = new PortalRequestContext(httpContext); ModuleExecutionEngine engine = new ModuleExecutionEngine(); bool actionRun = false; // Act engine.RunInModuleResultContext(portalContext, moduleResult, () => { actionRun = true; }); // Assert Assert.IsTrue(actionRun); }
public void RunInModuleContext_Sets_ActiveModuleRequest_Before_Calling_Delegate() { // Arrange HttpContextBase httpContext = Mockery.CreateMockHttpContext(); ModuleRequestResult moduleResult = new ModuleRequestResult(); PortalRequestContext portalContext = new PortalRequestContext(httpContext); ModuleExecutionEngine engine = new ModuleExecutionEngine(); // Act engine.RunInModuleResultContext(portalContext, moduleResult, () => { // Assert Assert.AreSame(moduleResult, portalContext.ActiveModuleRequest); }); }
public void RunInModuleContext_Restores_Original_ActiveModuleRequest_After_Returning_From_Delegate() { // Arrange HttpContextBase httpContext = Mockery.CreateMockHttpContext(); ModuleRequestResult moduleResult = new ModuleRequestResult(); ModuleRequestResult originalModuleResult = new ModuleRequestResult(); PortalRequestContext portalContext = new PortalRequestContext(httpContext); ModuleExecutionEngine engine = new ModuleExecutionEngine(); portalContext.ActiveModuleRequest = originalModuleResult; // Act engine.RunInModuleResultContext(portalContext, moduleResult, () => { }); // Assert Assert.AreSame(originalModuleResult, portalContext.ActiveModuleRequest); }