当前位置: 首页>>代码示例>>C#>>正文


C# Controller.Contextualize方法代码示例

本文整理汇总了C#中Castle.MonoRail.Framework.Controller.Contextualize方法的典型用法代码示例。如果您正苦于以下问题:C# Controller.Contextualize方法的具体用法?C# Controller.Contextualize怎么用?C# Controller.Contextualize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Castle.MonoRail.Framework.Controller的用法示例。


在下文中一共展示了Controller.Contextualize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetUp

        public void SetUp()
        {
            controller = new ReturnBinderTestController();
            viewEngineManager = new InjectableStubViewEngineManager();
            PrepareController(controller);

            services = controller.Context.Services as StubMonoRailServices;
            services.ViewEngineManager = viewEngineManager;

            engineContext = controller.Context as StubEngineContext;
            engineContext.Request.Headers.Add("User-Agent", "Test Fixture");

            controllerContext = services.ControllerContextFactory.
                Create("", "ReturnBinderTest", "Index", services.ControllerDescriptorProvider.BuildDescriptor(controller));

            controller.Contextualize(controller.Context, controllerContext);
            viewEngineManager.RegisterTemplate(string.Format("ReturnBinderTest{0}Index", Path.DirectorySeparatorChar));
        }
开发者ID:Eilon,项目名称:spark,代码行数:18,代码来源:FormatReturnBinderTests.cs

示例2: PrepareController

		/// <summary>
		/// Prepares the controller giving it mock implementations
		/// of the service it requires to function normally.
		/// </summary>
		/// <param name="controller">The controller.</param>
		/// <param name="areaName">Name of the area (cannot be null).</param>
		/// <param name="controllerName">Name of the controller.</param>
		/// <param name="actionName">Name of the action.</param>
		/// <param name="contextInitializer">The context initializer.</param>
		protected void PrepareController(Controller controller, string areaName, string controllerName, string actionName, ContextInitializer contextInitializer)
		{
			if (controller == null)
			{
				throw new ArgumentNullException("controller", "'controller' cannot be null");
			}
			if (areaName == null)
			{
				throw new ArgumentNullException("areaName");
			}
			if (controllerName == null)
			{
				throw new ArgumentNullException("controllerName");
			}
			if (actionName == null)
			{
				throw new ArgumentNullException("actionName");
			}

			cookies = new Dictionary<string, HttpCookie>(StringComparer.InvariantCultureIgnoreCase);

			BuildEngineContext(areaName, controllerName, actionName, contextInitializer);

			controllerContext = services.ControllerContextFactory.Create(areaName, controllerName, actionName, services.ControllerDescriptorProvider.BuildDescriptor(controller));

			controller.Contextualize(Context, controllerContext);
			controller.CreateStandardHelpers();

			controller.Initialize();
		}
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:39,代码来源:BaseControllerTest.cs


注:本文中的Castle.MonoRail.Framework.Controller.Contextualize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。