public static IRoutingStrategy <T> GetRouting <T>(RouteStrategy strategy) where T : ServiceInfo { IRoutingStrategy <T> routeStrategy; switch (strategy) { case RouteStrategy.Random: { routeStrategy = new RandomRoutingStrategy <T>(); break; } case RouteStrategy.LocalDevelop: { routeStrategy = new LocalDevelopRoutingStrategy <T>(); break; } default: routeStrategy = new RoundRobinRoutingStrategy <T>(); break; } return(routeStrategy); }
public void ThrowIfContextIsNotHttpContext() { var context = new Object(); var strategy = new RouteStrategy("__tenant__", configTestRoute); Assert.Throws <AggregateException>(() => strategy.GetIdentifierAsync(context).Result); }
public void ThrowIfContextIsNotHttpContext() { var context = new Object(); var adcp = new Mock <IActionDescriptorCollectionProvider>().Object; var strategy = new RouteStrategy("__tenant__", configTestRoute, adcp); Assert.Throws <AggregateException>(() => strategy.GetIdentifierAsync(context).Result); }
private void Button_Click_1(object sender, RoutedEventArgs e) { Stopwatch stopwatch; stopwatch = Stopwatch.StartNew(); stopwatch.Start(); output2.Text = RouteStrategy.decrypt(input2.Text); stopwatch.Stop(); timer2.Content = stopwatch.Elapsed.TotalMilliseconds + " ms"; }
public IConfigurationBuilder WithRoutingStrategy(RouteStrategy name) { DefaultRouteStrategy = name.ToString(); return(this); }
public void SetStrategy(RouteStrategy strategy) { this.strategy = strategy; }