public PermanentRedirectsTest() { IRoutingConfiguration config = A.Fake <IRoutingConfiguration>(); A.CallTo(() => config.Enabled).Returns(true); var redirects = new Dictionary <string, RoutingRedirectConfigurationElement>() { { "FooBar", new RoutingRedirectConfigurationElement() { SourceUrl = "Foo", TargetUrl = "Bar" } }, { "FooBar2", new RoutingRedirectConfigurationElement() { SourceUrl = "Foo2", TargetUrl = "~/Bar2" } }, { "FooBar3", new RoutingRedirectConfigurationElement() { SourceUrl = "Foo3", TargetUrl = "/Bar3" } } }; A.CallTo(() => config.PermanentRedirects).Returns(redirects); PermanentRedirects.Register(routes, config); }
public RegexRouter(IRoutingConfiguration routingConfiguration) { this.regexRoutes = routingConfiguration.RoutingTable.Select(x => { var routeText = x.RouteText; var regexRoute = PreapreRegexRoute(routeText); regexRoute.IsDefault = x.IsDefault; regexRoute.RouteData = x.RouteData; regexRoute.RouteId = x.RouteId; regexRoute.RouteText = x.RouteText; return(regexRoute); }).ToList(); }
/// <summary> /// This must be called by client code somewhere near the start of the application loading -- i.e. Application_Load to register permanent /// redirects within the applications RouteCollection. /// </summary> /// <remarks> ebrown, 11/10/2010. </remarks> /// <exception cref="ArgumentNullException"> Thrown when one or more required arguments are null. </exception> /// <param name="routeCollection"> The applications RouteCollection. </param> /// <param name="configuration"> A IRoutingConfigurationSection to read settings from. This interface is implemented by /// <see cref="T:EPS.Web.RoutingConfigurationSection"/> and can be retrieved by /// <code><![CDATA[new ConfigurationManagerWrapper().GetSection<RoutingConfigurationSection>(RoutingConfigurationSection.ConfigurationPath)]]></code> /// or can be faked for testing purposes. </param> public static void Register(RouteCollection routeCollection, IRoutingConfiguration configuration) { if (null == configuration) { throw new ArgumentNullException("configuration"); } if (configuration.Enabled) { //RouteTable.Routes.RouteExistingFiles = true; //RouteTable.Routes.RedirectPermanently("home/{foo}.aspx", "~/home/{foo}"); //http://haacked.com/archive/2008/12/15/redirect-routes-and-other-fun-with-routing-and-lambdas.aspx // The {*} instructs the route to match all content after the first slash (including extra slashes) foreach (var s in configuration.PermanentRedirects) routeCollection.RedirectPermanently(s.Value.SourceUrl, s.Value.TargetUrl); } }
public TransformTemplate(IRoutingConfiguration local) { var paramList = new List <RoutingParameter>(); //stuurinformatie = local.Stuurinformatie; foreach (var parameter in local.Parameters) { paramList.Add(new RoutingParameter { Name = parameter.Name, Location = parameter.Location }); } }
/// <summary> /// This must be called by client code somewhere near the start of the application loading -- i.e. Application_Load to register permanent /// redirects within the applications RouteCollection. /// </summary> /// <remarks> ebrown, 11/10/2010. </remarks> /// <exception cref="ArgumentNullException"> Thrown when one or more required arguments are null. </exception> /// <param name="routeCollection"> The applications RouteCollection. </param> /// <param name="configuration"> A IRoutingConfigurationSection to read settings from. This interface is implemented by /// <see cref="T:EPS.Web.RoutingConfigurationSection"/> and can be retrieved by /// <code><![CDATA[new ConfigurationManagerWrapper().GetSection<RoutingConfigurationSection>(RoutingConfigurationSection.ConfigurationPath)]]></code> /// or can be faked for testing purposes. </param> public static void Register(RouteCollection routeCollection, IRoutingConfiguration configuration) { if (null == configuration) { throw new ArgumentNullException("configuration"); } if (configuration.Enabled) { //RouteTable.Routes.RouteExistingFiles = true; //RouteTable.Routes.RedirectPermanently("home/{foo}.aspx", "~/home/{foo}"); //http://haacked.com/archive/2008/12/15/redirect-routes-and-other-fun-with-routing-and-lambdas.aspx // The {*} instructs the route to match all content after the first slash (including extra slashes) foreach (var s in configuration.PermanentRedirects) { routeCollection.RedirectPermanently(s.Value.SourceUrl, s.Value.TargetUrl); } } }
public void Initialize(string routerYaml = null) { if (routerYaml == null) { try { routerYaml = _yamlSourceController.GetYaml(YamlType.Routing); } catch { } } if (routerYaml != null) { //convert http to yaml routerYaml = YamlParser.ParseHelper(routerYaml); var deserializer = new DeserializerBuilder().Build(); routingConfiguration = deserializer.Deserialize <RoutingConfiguration>(routerYaml); } routingConfigurationSet = true; }
public ReplyManagerTests() { this.configMock = new Mock <IBotConfig>(); this.configMock.Setup(x => x.BotConfigurationPath).Returns("Bot/bot.json"); this.replyBuilderMock = new Mock <IReplyBuilder>(); this.seriazlierMock = new Mock <ISerializer>(); this.seriazlierMock.Setup(x => x.Deserialize <ReplyConfiguration>(It.IsAny <string>())).Returns(new ReplyConfiguration { Items = new[] { new ReplyItem { ReplyId = "hello", Routes = new [] { "hello", "test" }, ReplyType = "raw" } } }); var replyManager = new ReplyManager(this.configMock.Object, this.seriazlierMock.Object, new ReplyItem[] { }); this.routingConfiguration = replyManager; this.replyConfiguration = replyManager; }
public DefaultRouter(IRoutingConfiguration routingConfiguration) { this.routingConfiguration = routingConfiguration; }
public RouteHandler(IEnumerable <IRouter> routers, ISerializer serializer, IRoutingConfiguration routingConfiguration) { this.routers = routers.OrderBy(x => x.Priority).ToList(); this.serializer = serializer; this.globalRoutes = routingConfiguration.RoutingTable.Where(x => x.IsGlobalCommand).ToDictionary(x => RemoveAccents(x.RouteText), x => x); }
public NluRouter(IRoutingConfiguration routingConfiguration, INlu nlu) { this.routingConfiguration = routingConfiguration; this.nlu = nlu; }
public AsrRouter(IRoutingConfiguration routingConfiguration, IAsr asr) { this.routingConfiguration = routingConfiguration; this.asr = asr; }