mirror of https://github.com/abpframework/abp.git
3 changed files with 59 additions and 1 deletions
@ -0,0 +1,37 @@ |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Options; |
|||
using Shouldly; |
|||
using Volo.Abp.Settings; |
|||
using Xunit; |
|||
|
|||
namespace Volo.Abp.MultiTenancy; |
|||
|
|||
public class CurrentUserTenantResolveContributor_Tests : MultiTenancyTestBase |
|||
{ |
|||
protected override void AfterAddApplication(IServiceCollection services) |
|||
{ |
|||
services.Configure<AbpTenantResolveOptions>(options => |
|||
{ |
|||
options.TenantResolvers.Add(new TestTenantResolveContributor()); |
|||
}); |
|||
} |
|||
|
|||
[Fact] |
|||
public void CurrentUserTenantResolveContributor_Should_Add_First() |
|||
{ |
|||
var options = GetRequiredService<IOptions<AbpTenantResolveOptions>>().Value; |
|||
options.TenantResolvers.First().GetType().ShouldBe(typeof(CurrentUserTenantResolveContributor)); |
|||
} |
|||
|
|||
class TestTenantResolveContributor : ITenantResolveContributor |
|||
{ |
|||
public string Name { get; } |
|||
|
|||
public Task ResolveAsync(ITenantResolveContext context) |
|||
{ |
|||
throw new System.NotImplementedException(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
using Microsoft.Extensions.Options; |
|||
using Shouldly; |
|||
using Volo.Abp.Settings; |
|||
using Xunit; |
|||
|
|||
namespace Volo.Abp.MultiTenancy; |
|||
|
|||
public class TenantSettingValueProvider_Tests : MultiTenancyTestBase |
|||
{ |
|||
[Fact] |
|||
public void TenantSettingValueProvider_Should_Add_Correction() |
|||
{ |
|||
var options = GetRequiredService<IOptions<AbpSettingOptions>>().Value; |
|||
|
|||
options.ValueProviders[0].ShouldBe(typeof(DefaultValueSettingValueProvider)); |
|||
options.ValueProviders[1].ShouldBe(typeof(ConfigurationSettingValueProvider)); |
|||
options.ValueProviders[2].ShouldBe(typeof(GlobalSettingValueProvider)); |
|||
options.ValueProviders[3].ShouldBe(typeof(TenantSettingValueProvider)); |
|||
options.ValueProviders[4].ShouldBe(typeof(UserSettingValueProvider)); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue