mirror of https://github.com/abpframework/abp.git
4 changed files with 40 additions and 3 deletions
@ -0,0 +1,37 @@ |
|||||
|
using Shouldly; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Volo.Abp.MultiTenancy |
||||
|
{ |
||||
|
public class AsyncLocalAmbientTenantScopeProvider_Tests |
||||
|
{ |
||||
|
[Fact] |
||||
|
public void Should_Support_Inner_Scopes() |
||||
|
{ |
||||
|
var scopeProvider = new AsyncLocalAmbientTenantScopeProvider(); |
||||
|
|
||||
|
scopeProvider.CurrentScope.ShouldBeNull(); |
||||
|
|
||||
|
using (scopeProvider.EnterScope(new TenantInfo("1","A"))) |
||||
|
{ |
||||
|
scopeProvider.CurrentScope.Tenant.Name.ShouldBe("A"); |
||||
|
|
||||
|
using (scopeProvider.EnterScope(new TenantInfo("2", "B"))) |
||||
|
{ |
||||
|
scopeProvider.CurrentScope.Tenant.Name.ShouldBe("B"); |
||||
|
|
||||
|
using (scopeProvider.EnterScope(null)) |
||||
|
{ |
||||
|
scopeProvider.CurrentScope.Tenant.ShouldBeNull(); |
||||
|
} |
||||
|
|
||||
|
scopeProvider.CurrentScope.Tenant.Name.ShouldBe("B"); |
||||
|
} |
||||
|
|
||||
|
scopeProvider.CurrentScope.Tenant.Name.ShouldBe("A"); |
||||
|
} |
||||
|
|
||||
|
scopeProvider.CurrentScope.ShouldBeNull(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue