예제 #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;
 }