Beispiel #1
0
    public void AddBasePathStrategy()
    {
        var services = new ServiceCollection();
        var builder  = new FinbuckleMultiTenantBuilder(services);

        builder.WithBasePathStrategy();
        var sp = services.BuildServiceProvider();

        var strategy = sp.GetRequiredService <IMultiTenantStrategy>();

        Assert.IsType <MultiTenantStrategyWrapper <BasePathStrategy> >(strategy);
    }
        public void AddBasePathStrategyWithOptions()
        {
            var services = new ServiceCollection();
            var builder  = new FinbuckleMultiTenantBuilder <TenantInfo>(services);

            builder.WithBasePathStrategy(options => options.RebaseAspNetCorePathBase = true);
            var sp = services.BuildServiceProvider();

            var strategy = sp.GetRequiredService <IMultiTenantStrategy>();

            Assert.IsType <BasePathStrategy>(strategy);

            var options = sp.GetRequiredService <IOptions <BasePathStrategyOptions> >();

            Assert.True(options.Value.RebaseAspNetCorePathBase);
        }