public void Init() { request = new StubRequest(); response = new StubResponse(); services = new StubMonoRailServices(); engineContext = new StubEngineContext(request, response, services, null); }
public virtual void Init() { mocks = new MockRepository(); var services = new StubMonoRailServices(); services.ViewSourceLoader = new FileAssemblyViewSourceLoader("MonoRail.Tests.Views"); services.AddService(typeof(IViewSourceLoader), services.ViewSourceLoader); viewComponentFactory = new DefaultViewComponentFactory(); viewComponentFactory.Initialize(); services.AddService(typeof(IViewComponentFactory), viewComponentFactory); services.AddService(typeof(IViewComponentRegistry), viewComponentFactory.Registry); var settings = new SparkSettings(); engine = new SparkViewEngine(settings); services.AddService(typeof(ISparkViewEngine), engine); factory = new SparkViewFactory(); factory.Service(services); controller = MockRepository.GenerateMock <IController>(); controllerContext = new ControllerContext(); var request = new StubRequest(); request.FilePath = ""; var response = new StubResponse(); engineContext = new StubEngineContext(request, response, new UrlInfo("", "Home", "Index", "/", "castle")); engineContext.AddService(typeof(IViewComponentFactory), viewComponentFactory); engineContext.AddService(typeof(IViewComponentRegistry), viewComponentFactory.Registry); }
public virtual void Setup() { response = new StubResponse(); var url = new UrlInfo("eleutian.com", "www", virtualDirectory, "http", 80, Path.Combine(Path.Combine("Area", "Controller"), "Action"), "Area", "Controller", "Action", "rails", ""); var stubEngineContext = new StubEngineContext(new StubRequest(), response, new StubMonoRailServices(), url) { Server = MockRepository.GenerateMock<IServerUtility>() }; railsContext = stubEngineContext; serverUtility = railsContext.Server; argumentConversionService = MockRepository.GenerateMock<IArgumentConversionService>(); controller = new TestController(); controller.Contextualize(railsContext, MockRepository.GenerateStub<IControllerContext>()); parameters = new Hashtable(); services = MockRepository.GenerateMock<ICodeGeneratorServices>(); services.Expect(s => s.ArgumentConversionService).Return(argumentConversionService).Repeat.Any(); services.Expect(s => s.Controller).Return(controller).Repeat.Any(); services.Expect(s => s.RailsContext).Return(railsContext).Repeat.Any(); argumentConversionService.Expect(s => s.CreateParameters()).Return(parameters).Repeat.Any(); }
public void ValidateTest() { //Act Quest quest = new FakeQuest(); StubResponse response = new StubResponse(); IQuestValidator <StubResponse> firstValidator = MockRepository.GenerateStrictMock <IQuestValidator <StubResponse> >(); firstValidator. Expect(v => v.Validate(Arg <Quest> .Is.Equal(quest))). Repeat.Once(). Return(response); IQuestValidator <StubResponse> secondValidator = MockRepository.GenerateStrictMock <IQuestValidator <StubResponse> >(); secondValidator. Expect(v => v.Validate(Arg <Quest> .Is.Equal(quest))). Repeat.Once(). Return(response); CompositeQuestValidator <StubResponse> validator = new CompositeQuestValidator <StubResponse>(new [] { firstValidator, secondValidator }); //Arrange StubResponse returnedResponse = validator.Validate(quest); //Assert Assert.IsNotNull(returnedResponse); firstValidator.VerifyAllExpectations(); secondValidator.VerifyAllExpectations(); }
public virtual void Setup() { response = new StubResponse(); var url = new UrlInfo("eleutian.com", "www", virtualDirectory, "http", 80, Path.Combine(Path.Combine("Area", "Controller"), "Action"), "Area", "Controller", "Action", "rails", ""); var stubEngineContext = new StubEngineContext(new StubRequest(), response, new StubMonoRailServices(), url) { Server = MockRepository.GenerateMock <IServerUtility>() }; railsContext = stubEngineContext; serverUtility = railsContext.Server; argumentConversionService = MockRepository.GenerateMock <IArgumentConversionService>(); controller = new TestController(); controller.Contextualize(railsContext, MockRepository.GenerateStub <IControllerContext>()); parameters = new Hashtable(); services = MockRepository.GenerateMock <ICodeGeneratorServices>(); services.Expect(s => s.ArgumentConversionService).Return(argumentConversionService).Repeat.Any(); services.Expect(s => s.Controller).Return(controller).Repeat.Any(); services.Expect(s => s.RailsContext).Return(railsContext).Repeat.Any(); argumentConversionService.Expect(s => s.CreateParameters()).Return(parameters).Repeat.Any(); }
public void RegisterNewCodeFiscale(string codeFiscale, int registrationId, int subRegistrationId, int labelId) { var configurableResponses = new StubResponse { Items = new[] { new CodeFiscaleData { SubregistrationResponseCode = subRegistrationId, IndividualAccountOpeningResponseCode = registrationId, Subregistration2ResponseCode = subRegistrationId, FiscalCode = codeFiscale } } }; var serializer = new XmlSerializer(typeof(StubResponse)); var builder = new StringBuilder(); var settings = new XmlWriterSettings { OmitXmlDeclaration = true }; using (var stringWriter = XmlWriter.Create(builder, settings)) { var ns = new XmlSerializerNamespaces(); ns.Add(string.Empty, string.Empty); serializer.Serialize(stringWriter, configurableResponses, ns); } var url = string.Format(_configuration.CreateCodeFiscaleUrl, labelId); _requestHandler.ExecutePost(url, builder.ToString()); }
public void RedirectToUrlDoesNotTouchUrl() { UrlInfo url = new UrlInfo("area", "home", "index", "", ".castle"); StubResponse response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, new RouteMatch()); response.RedirectToUrl("/uol/com/folha"); Assert.AreEqual("/uol/com/folha", response.RedirectedTo); }
public void RedirectToUrlDoesNotTouchUrl() { var url = new UrlInfo("area", "home", "index", "", ".castle"); var response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, new RouteMatch()); response.RedirectToUrl("/uol/com/folha"); Assert.AreEqual("/uol/com/folha", response.RedirectedTo); }
protected override IMockResponse BuildResponse(UrlInfo info) { var response = new StubResponse(info, new DefaultUrlBuilder(), new StubServerUtility(), new RouteMatch(), referrer); return response; }
public void Init() { var request = new StubRequest(); response = new StubResponse(); services = new StubMonoRailServices(); engStubViewEngineManager = new StubViewEngineManager(); services.ViewEngineManager = engStubViewEngineManager; engineContext = new StubEngineContext(request, response, services, null); }
public void RedirectToUrlWithQueryStringAsDict() { UrlInfo url = new UrlInfo("area", "home", "index", "", ".castle"); StubResponse response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, new RouteMatch()); response.RedirectToUrl("/uol/com/folha", DictHelper.Create("id=1", "name=john doe")); Assert.AreEqual("/uol/com/folha?id=1&name=john+doe", response.RedirectedTo); response.RedirectToUrl("/uol/com/folha?something=1", DictHelper.Create("id=1", "name=john doe")); Assert.AreEqual("/uol/com/folha?something=1&id=1&name=john+doe", response.RedirectedTo); }
public void Init() { selector = new DefaultActionSelector(); var request = new StubRequest(); var response = new StubResponse(); var services = new StubMonoRailServices(); engine = new StubEngineContext(request, response, services, new UrlInfo("area", "controller", "action1")); }
public void ShouldThrowAnExceptionIfCantCreateAnIndex() { var response = new StubResponse(400); MockElasticClient.Setup(x => x.CreateIndex(It.IsAny <IndexName>(), It.IsAny <Func <CreateIndexDescriptor, ICreateIndexRequest> >(), It.IsAny <string>())).Returns(response); var indexMaintainer = new ElasticsearchApprenticeshipIndexMaintainer(MockElasticClient.Object, Mock.Of <IElasticsearchMapper>(), Mock.Of <ILog>(), Mock.Of <IElasticsearchConfiguration>()); Assert.Throws <ConnectionException>(() => indexMaintainer.CreateIndex("testindex")); }
public void RedirectToUrlWithQueryStringAsDict() { var url = new UrlInfo("area", "home", "index", "", ".castle"); var response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, new RouteMatch()); response.RedirectToUrl("/uol/com/folha", DictHelper.Create("id=1", "name=john doe")); Assert.AreEqual("/uol/com/folha?id=1&name=john+doe", response.RedirectedTo); response.RedirectToUrl("/uol/com/folha?something=1", DictHelper.Create("id=1", "name=john doe")); Assert.AreEqual("/uol/com/folha?something=1&id=1&name=john+doe", response.RedirectedTo); }
public void Init() { var request = new StubRequest(); var response = new StubResponse(); services = new StubMonoRailServices(); engStubViewEngineManager = new StubViewEngineManager(); services.ViewEngineManager = engStubViewEngineManager; filterFactoryMock = mockRepository.DynamicMock<IFilterFactory>(); services.FilterFactory = filterFactoryMock; engineContext = new StubEngineContext(request, response, services, null); }
public void RedirectToSiteRootUsesAppVirtualDir() { UrlInfo url = new UrlInfo("area", "home", "index", "", ".castle"); StubResponse response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, new RouteMatch()); response.RedirectToSiteRoot(); Assert.AreEqual("/", response.RedirectedTo); url = new UrlInfo("area", "home", "index", "/app", ".castle"); response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, new RouteMatch()); response.RedirectToSiteRoot(); Assert.AreEqual("/app/", response.RedirectedTo); }
public void Init() { resourceFactoryMock = mockRepository.DynamicMock<IResourceFactory>(); StubRequest request = new StubRequest(); StubResponse response = new StubResponse(); services = new StubMonoRailServices(); engStubViewEngineManager = new StubViewEngineManager(); services.ViewEngineManager = engStubViewEngineManager; services.ResourceFactory = resourceFactoryMock; engineContext = new StubEngineContext(request, response, services, null); }
public void Redirect_ToControllerAction() { UrlInfo url = new UrlInfo("area", "home", "index", "", ".castle"); StubResponse response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, new RouteMatch()); response.Redirect("cart", "view"); Assert.AreEqual("/area/cart/view.castle", response.RedirectedTo); url = new UrlInfo("", "home", "index", "", ".castle"); response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, new RouteMatch()); response.Redirect("cart", "view"); Assert.AreEqual("/cart/view.castle", response.RedirectedTo); }
public void Init() { var request = new StubRequest(); var response = new StubResponse(); services = new StubMonoRailServices(); engStubViewEngineManager = new StubViewEngineManager(); services.ViewEngineManager = engStubViewEngineManager; filterFactoryMock = mockRepository.DynamicMock <IFilterFactory>(); services.FilterFactory = filterFactoryMock; engineContext = new StubEngineContext(request, response, services, null); }
public void RedirectUsingRoute_SpecifyingParameters() { engine.Add(new PatternRoute("/something/<param1>/admin/[controller]/[action]/[id]")); var match = new RouteMatch(); var url = new UrlInfo("area", "home", "index", "", ".castle"); var response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, match); response.RedirectUsingRoute("cart", "checkout", DictHelper.Create("param1=Marge")); Assert.AreEqual("/something/Marge/admin/cart/checkout", response.RedirectedTo); }
public void RedirectToSiteRootUsesAppVirtualDir() { var url = new UrlInfo("area", "home", "index", "", ".castle"); var response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, new RouteMatch()); response.RedirectToSiteRoot(); Assert.AreEqual("/", response.RedirectedTo); url = new UrlInfo("area", "home", "index", "/app", ".castle"); response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, new RouteMatch()); response.RedirectToSiteRoot(); Assert.AreEqual("/app/", response.RedirectedTo); }
public void Redirect_ToAreaControllerAction() { var url = new UrlInfo("area", "home", "index", "", ".castle"); var response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, new RouteMatch()); response.Redirect("admin", "cart", "view"); Assert.AreEqual("/admin/cart/view.castle", response.RedirectedTo); url = new UrlInfo("", "home", "index", "", ".castle"); response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, new RouteMatch()); response.Redirect("admin", "cart", "view"); Assert.AreEqual("/admin/cart/view.castle", response.RedirectedTo); }
public void RedirectUsingRoute_InheritingParameters() { engine.Add(new PatternRoute("/something/<param1>/admin/[controller]/[action]/[id]")); var match = new RouteMatch(); match.AddNamed("param1", "Homer"); var url = new UrlInfo("area", "home", "index", "", ".castle"); var response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, match); response.RedirectUsingRoute("cart", "checkout", true); Assert.AreEqual("/something/Homer/admin/cart/checkout", response.RedirectedTo); }
public void DelegatesToDynamicAction() { var dynAction = new ActionStub(); var executor = new DynamicActionExecutor(dynAction); var req = new StubRequest(); var res = new StubResponse(); var services = new StubMonoRailServices(); IEngineContext engineContext = new StubEngineContext(req, res, services, new UrlInfo("area", "controller", "action")); var retVal = executor.Execute(engineContext, new DummyController(), new ControllerContext()); Assert.IsTrue(dynAction.WasExecuted); Assert.AreEqual(3, retVal); }
public void ExecutesActionAndReturnValue() { var controller = new BaseController(); var actionMeta = new ActionMetaDescriptor(); var executor = new ActionMethodExecutor(GetActionMethod(controller), actionMeta); var req = new StubRequest(); var res = new StubResponse(); var services = new StubMonoRailServices(); IEngineContext engineContext = new StubEngineContext(req, res, services, new UrlInfo("area", "controller", "action")); var retVal = executor.Execute(engineContext, controller, new ControllerContext()); Assert.IsTrue(controller.WasExecuted); Assert.AreEqual(1, retVal); }
public void Init() { StubRequest request = new StubRequest(); response = new StubResponse(); StubMonoRailServices services = new StubMonoRailServices(); engStubViewEngineManager = new StubViewEngineManager(); services.ViewEngineManager = engStubViewEngineManager; engineContext = new StubEngineContext(request, response, services, new UrlInfo("area", "controller", "action")); generator = new JQueryAjaxProxyGenerator(); generator.ControllerTree = services.ControllerTree; generator.ControllerDescriptorBuilder = services.ControllerDescriptorProvider; services.ControllerTree.AddController("area", "controller1", typeof(NoAjaxController)); services.ControllerTree.AddController("", "controller2", typeof(AjaxController)); }
public void CompatibleExecutorDelegatesInvocationToControllerUsingDelegate() { var controller = new BaseController(); var actionMeta = new ActionMetaDescriptor(); ActionMethodExecutorCompatible.InvokeOnController delegateToController = controller.InvokeMethodStub; var executor = new ActionMethodExecutorCompatible(GetActionMethod(controller), actionMeta, delegateToController); var req = new StubRequest(); var res = new StubResponse(); var services = new StubMonoRailServices(); IEngineContext engineContext = new StubEngineContext(req, res, services, new UrlInfo("area", "controller", "action")); var retVal = executor.Execute(engineContext, controller, new ControllerContext()); Assert.IsTrue(controller.WasExecuted); Assert.AreEqual(2, retVal); }
public virtual void Setup() { _mocks = new MockRepository(); _services = _mocks.DynamicMock <ICodeGeneratorServices>(); _response = new StubResponse(); UrlInfo url = new UrlInfo("eleutian.com", "www", _virtualDirectory, "http", 80, Path.Combine(Path.Combine("Area", "Controller"), "Action"), "Area", "Controller", "Action", "rails", ""); _railsContext = new StubEngineContext(new StubRequest(), _response, new StubMonoRailServices(), url); ((StubEngineContext)_railsContext).Server = _mocks.DynamicMock <IServerUtility>(); _serverUtility = _railsContext.Server; _argumentConversionService = _mocks.DynamicMock <IArgumentConversionService>(); _controller = new TestController(); }
public void Init() { var request = new StubRequest(); response = new StubResponse(); var services = new StubMonoRailServices(); engStubViewEngineManager = new StubViewEngineManager(); services.ViewEngineManager = engStubViewEngineManager; engineContext = new StubEngineContext(request, response, services, new UrlInfo("area", "controller", "action")); generator = new PrototypeAjaxProxyGenerator { ControllerTree = services.ControllerTree, ControllerDescriptorBuilder = services.ControllerDescriptorProvider }; services.ControllerTree.AddController("area", "controller1", typeof(NoAjaxController)); services.ControllerTree.AddController("", "controller2", typeof(AjaxController)); }
public async Task ShouldFilterOutStandardsThatAreNotValid() { var response = new StubResponse(400); var mockResponse = new Mock <IBulkResponse> { DefaultValue = DefaultValue.Mock }; var mockSettings = new Mock <IInfrastructureSettings>(); mockSettings.SetupGet(x => x.FrameworkIdFormat).Returns("{0}{1}{2}"); MockElasticClient.Setup(x => x.CreateIndex(It.IsAny <IndexName>(), It.IsAny <Func <CreateIndexDescriptor, ICreateIndexRequest> >(), It.IsAny <string>())).Returns(response); MockElasticClient.Setup(x => x.BulkAsync(It.IsAny <IBulkRequest>(), It.IsAny <string>())).Returns(Task.FromResult <IBulkResponse>(mockResponse.Object)); var indexMaintainer = new ElasticsearchApprenticeshipIndexMaintainer( MockElasticClient.Object, new ElasticsearchMapper(mockSettings.Object, Mock.Of <IOrganisationTypeProcessor>()), Mock.Of <ILog>(), Mock.Of <IElasticsearchConfiguration>()); await indexMaintainer.IndexStandards("testindex", StandardsTestData4001WithOneNull()); MockElasticClient.Verify(x => x.BulkAsync(It.IsAny <IBulkRequest>(), It.IsAny <string>()), Times.Exactly(1)); }
public void RedirectUsingRoute_InheritingParameters() { engine.Add(new PatternRoute("/something/<param1>/admin/[controller]/[action]/[id]")); RouteMatch match = new RouteMatch(); match.AddNamed("param1", "Homer"); UrlInfo url = new UrlInfo("area", "home", "index", "", ".castle"); StubResponse response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, match); response.RedirectUsingRoute("cart", "checkout", true); Assert.AreEqual("/something/Homer/admin/cart/checkout", response.RedirectedTo); }
public void SetUp() { var en = CultureInfo.CreateSpecificCulture("en"); Thread.CurrentThread.CurrentCulture = en; Thread.CurrentThread.CurrentUICulture = en; Layout = null; PropertyBag = new Hashtable(StringComparer.InvariantCultureIgnoreCase); Helpers = new HelperDictionary(); var services = new StubMonoRailServices { UrlBuilder = new DefaultUrlBuilder(new StubServerUtility(), new StubRoutingEngine()), UrlTokenizer = new DefaultUrlTokenizer(), CacheProvider = new StubCacheProvider() }; services.AddService(typeof(ICacheProvider), services.CacheProvider); var urlInfo = new UrlInfo( "example.org", "test", "", "http", 80, "http://test.example.org/test_area/test_controller/test_action.tdd", Area, ControllerName, Action, "tdd", "no.idea"); Response = new StubResponse(); EngineContext = new StubEngineContext(new StubRequest(), Response, services, urlInfo); services.AddService(typeof(IEngineContext), EngineContext); EngineContext.AddService <IEngineContext>(EngineContext); EngineContext.AddService <IUrlBuilder>(services.UrlBuilder); EngineContext.AddService <IUrlTokenizer>(services.UrlTokenizer); EngineContext.AddService <ICacheProvider>(services.CacheProvider); ViewComponentFactory = new DefaultViewComponentFactory(); ViewComponentFactory.Service(EngineContext); EngineContext.AddService <IViewComponentFactory>(ViewComponentFactory); services.AddService(typeof(IViewComponentFactory), ViewComponentFactory); EngineContext.AddService <IViewComponentDescriptorProvider>(new DefaultViewComponentDescriptorProvider()); services.AddService(typeof(IViewComponentDescriptorProvider), EngineContext.GetService <IViewComponentDescriptorProvider>()); ControllerContext = new ControllerContext { Helpers = Helpers, PropertyBag = PropertyBag }; EngineContext.CurrentControllerContext = ControllerContext; Helpers["formhelper"] = Helpers["form"] = new FormHelper(EngineContext); Helpers["urlhelper"] = Helpers["url"] = new UrlHelper(EngineContext); Helpers["dicthelper"] = Helpers["dict"] = new DictHelper(EngineContext); Helpers["DateFormatHelper"] = Helpers["DateFormat"] = new DateFormatHelper(EngineContext); var viewPath = Path.Combine(ViewSourcePath, "Views"); var loader = new FileAssemblyViewSourceLoader(viewPath); services.ViewSourceLoader = loader; services.AddService(typeof(IViewSourceLoader), services.ViewSourceLoader); EngineContext.AddService <IViewSourceLoader>(services.ViewSourceLoader); Controller = new BaseTestFixtureController(); Controller.Contextualize(EngineContext, ControllerContext); VelocityViewEngine = new NVelocityViewEngine(); services.AddService(typeof(IViewEngine), VelocityViewEngine); EngineContext.AddService <IViewEngine>(VelocityViewEngine); VelocityViewEngine.SetViewSourceLoader(loader); VelocityViewEngine.Service(services); var viewEngineManager = new DefaultViewEngineManager(); viewEngineManager.RegisterEngineForExtesionLookup(VelocityViewEngine); services.EmailTemplateService = new EmailTemplateService(viewEngineManager); BeforEachTest(); }
public void SetUp() { var en = CultureInfo.CreateSpecificCulture("en"); Thread.CurrentThread.CurrentCulture = en; Thread.CurrentThread.CurrentUICulture = en; Layout = null; PropertyBag = new Hashtable(StringComparer.InvariantCultureIgnoreCase); Helpers = new HelperDictionary(); var services = new StubMonoRailServices { UrlBuilder = new DefaultUrlBuilder(new StubServerUtility(), new StubRoutingEngine()), UrlTokenizer = new DefaultUrlTokenizer(), CacheProvider = new StubCacheProvider() }; services.AddService(typeof(ICacheProvider), services.CacheProvider); var urlInfo = new UrlInfo( "example.org", "test", "", "http", 80, "http://test.example.org/test_area/test_controller/test_action.tdd", Area, ControllerName, Action, "tdd", "no.idea"); Response = new StubResponse(); EngineContext = new StubEngineContext(new StubRequest(), Response, services, urlInfo); services.AddService(typeof(IEngineContext), EngineContext); EngineContext.AddService<IEngineContext>(EngineContext); EngineContext.AddService<IUrlBuilder>(services.UrlBuilder); EngineContext.AddService<IUrlTokenizer>(services.UrlTokenizer); EngineContext.AddService<ICacheProvider>(services.CacheProvider); ViewComponentFactory = new DefaultViewComponentFactory(); ViewComponentFactory.Service(EngineContext); EngineContext.AddService<IViewComponentFactory>(ViewComponentFactory); services.AddService(typeof(IViewComponentFactory), ViewComponentFactory); EngineContext.AddService<IViewComponentDescriptorProvider>(new DefaultViewComponentDescriptorProvider()); services.AddService(typeof(IViewComponentDescriptorProvider), EngineContext.GetService<IViewComponentDescriptorProvider>()); ControllerContext = new ControllerContext { Helpers = Helpers, PropertyBag = PropertyBag }; EngineContext.CurrentControllerContext = ControllerContext; Helpers["formhelper"] = Helpers["form"] = new FormHelper(EngineContext); Helpers["urlhelper"] = Helpers["url"] = new UrlHelper(EngineContext); Helpers["dicthelper"] = Helpers["dict"] = new DictHelper(EngineContext); Helpers["DateFormatHelper"] = Helpers["DateFormat"] = new DateFormatHelper(EngineContext); var viewPath = Path.Combine(ViewSourcePath, "Views"); var loader = new FileAssemblyViewSourceLoader(viewPath); services.ViewSourceLoader = loader; services.AddService(typeof(IViewSourceLoader), services.ViewSourceLoader); EngineContext.AddService<IViewSourceLoader>(services.ViewSourceLoader); Controller = new BaseTestFixtureController(); Controller.Contextualize(EngineContext, ControllerContext); VelocityViewEngine = new NVelocityViewEngine(); services.AddService(typeof(IViewEngine), VelocityViewEngine); EngineContext.AddService<IViewEngine>(VelocityViewEngine); VelocityViewEngine.SetViewSourceLoader(loader); VelocityViewEngine.Service(services); var viewEngineManager = new DefaultViewEngineManager(); viewEngineManager.RegisterEngineForExtesionLookup(VelocityViewEngine); services.EmailTemplateService = new EmailTemplateService(viewEngineManager); BeforEachTest(); }
public void RedirectUsingRoute_SpecifyingParameters() { engine.Add(new PatternRoute("/something/<param1>/admin/[controller]/[action]/[id]")); RouteMatch match = new RouteMatch(); UrlInfo url = new UrlInfo("area", "home", "index", "", ".castle"); StubResponse response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, match); response.RedirectUsingRoute("cart", "checkout", DictHelper.Create("param1=Marge")); Assert.AreEqual("/something/Marge/admin/cart/checkout", response.RedirectedTo); }