示例#1
0
        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);
        }
示例#2
0
    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);
    }
示例#4
0
        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);
 }
示例#6
0
 public void SetStrategy(RouteStrategy strategy)
 {
     this.strategy = strategy;
 }