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


C# IEngine.Replay方法代码示例

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


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

示例1: SetUp

        public override void SetUp()
        {
            base.SetUp();

            root = CreateOneItem<RegularPage>(1, "root", null);
            about = CreateOneItem<AboutUsSectionPage>(2, "about", root);
            executives = CreateOneItem<ExecutiveTeamPage>(3, "executives", about);
            search = CreateOneItem<SearchPage>(4, "search", root);

            var typeFinder = new FakeTypeFinder2();
            typeFinder.typeMap[typeof(ContentItem)] = this.NearbyTypes()
                .BelowNamespace("N2.Extensions.Tests.Mvc.Models").AssignableTo<ContentItem>().Union(typeof(ContentItem)).ToArray();
            typeFinder.typeMap[typeof(IController)] = this.NearbyTypes()
                .BelowNamespace("N2.Extensions.Tests.Mvc.Controllers").AssignableTo<IController>().Except(typeof(AnotherRegularController))
                .ToArray();

            var changer = new StateChanger();
            var definitions = new DefinitionManager(new[] { new DefinitionProvider(new DefinitionBuilder(new DefinitionMap(), typeFinder, new TransformerBase<IUniquelyNamed>[0], TestSupport.SetupEngineSection())) }, new ITemplateProvider[0], new ContentActivator(changer, null, new EmptyProxyFactory()), changer);
            httpContext = new FakeHttpContext();
            var webContext = new FakeWebContextWrapper(httpContext);
            var host = new Host(webContext, root.ID, root.ID);
            var parser = TestSupport.Setup(persister, webContext, host);
            controllerMapper = new ControllerMapper(typeFinder, definitions);
            Url.DefaultExtension = "";
            N2.Web.Url.ApplicationPath = "/";

            engine = mocks.DynamicMock<IEngine>();
            SetupResult.For(engine.Resolve<ITypeFinder>()).Return(typeFinder);
            SetupResult.For(engine.Definitions).Return(definitions);
            SetupResult.For(engine.UrlParser).Return(parser);
            SetupResult.For(engine.Persister).Return(persister);
            SetupResult.For(engine.Resolve<RequestPathProvider>()).Return(new RequestPathProvider(webContext, parser, new ErrorNotifier(), new HostSection()));
            var editUrlManager = new FakeEditUrlManager();
            SetupResult.For(engine.ManagementPaths).Return(editUrlManager);
            engine.Replay();

            route = new ContentRoute(engine, new MvcRouteHandler(), controllerMapper, null);

            routes = new RouteCollection { route };
        }
开发者ID:GrimaceOfDespair,项目名称:n2cms,代码行数:40,代码来源:ContentRouteTests.cs

示例2: SetUp

        public override void SetUp()
        {
            base.SetUp();

            root = CreateOneItem<RegularPage>(1, "root", null);
            about = CreateOneItem<AboutUsSectionPage>(2, "about", root);
            executives = CreateOneItem<ExecutiveTeamPage>(3, "executives", about);
            search = CreateOneItem<SearchPage>(4, "search", root);

            var typeFinder = new FakeTypeFinder2();
            typeFinder.typeMap[typeof(ContentItem)] = this.NearbyTypes()
                .BelowNamespace("N2.Extensions.Tests.Mvc.Models").AssignableTo<ContentItem>().Union(typeof(ContentItem)).ToArray();
            typeFinder.typeMap[typeof(IController)] = this.NearbyTypes()
                .BelowNamespace("N2.Extensions.Tests.Mvc.Controllers").AssignableTo<IController>().Except(typeof(AnotherRegularController))
                .ToArray();

            var editUrlManager = new FakeEditUrlManager();
            var definitions = new DefinitionManager(new DefinitionBuilder(typeFinder, new EngineSection(), editUrlManager), new N2.Edit.Workflow.StateChanger(), null, new EmptyProxyFactory());
            var webContext = new ThreadContext();
            var host = new Host(webContext, root.ID, root.ID);
            var parser = new UrlParser(persister, webContext, host, new HostSection());
            controllerMapper = new ControllerMapper(typeFinder, definitions);
            Url.DefaultExtension = "";

            engine = mocks.DynamicMock<IEngine>();
            SetupResult.For(engine.Resolve<ITypeFinder>()).Return(typeFinder);
            SetupResult.For(engine.Definitions).Return(definitions);
            SetupResult.For(engine.UrlParser).Return(parser);
            SetupResult.For(engine.Persister).Return(persister);
            SetupResult.For(engine.ManagementPaths).Return(editUrlManager);
            engine.Replay();

            route = new ContentRoute(engine, new MvcRouteHandler(), controllerMapper, null);

            httpContext = new FakeHttpContext();
            routes = new RouteCollection { route };
        }
开发者ID:spmason,项目名称:n2cms,代码行数:37,代码来源:ContentRouteTests.cs


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