コード例 #1
0
        protected PageViewEngineResult CreateResult(Type pageType, object parameters, object model)
        {
            var request = RequestBuilder.CreateRequest("X", "Y", parameters);
            request.Navigator = Navigator;
            request.Navigator.SetupGet(x => x.Dispatcher).Returns(new SingleThreadDispatcher());
            
            var options = new ViewResultOptions(parameters);
            options.SetModel(model);

            return new PageViewEngineResult(
                pageType,
                options, 
                request.BuildControllerContext(),
                new DefaultViewActivator()
                );
        }
コード例 #2
0
        protected PageViewEngineResult CreateResult(object page, object parameters, object model)
        {
            var request = RequestBuilder.CreateRequest("X", "Y", parameters);
            request.Navigator = Navigator;
            request.Navigator.SetupGet(x => x.Dispatcher).Returns(new SingleThreadDispatcher());

            var options = new ViewResultOptions(parameters);
            options.SetModel(model);

            var viewActivator = new Mock<IViewActivator>();
            viewActivator.Setup(x => x.Instantiate(It.IsAny<Type>())).Returns(page);

            return new PageViewEngineResult(
                page.GetType(),
                options,
                request.BuildControllerContext(),
                viewActivator.Object
                );
        }