|
|
|
@ -70,4 +70,36 @@ public class AspNetCoreMultiTenancy_Without_DomainResolver_Tests : AspNetCoreMul |
|
|
|
var result = await GetResponseAsObjectAsync<Dictionary<string, string>>("http://abp.io"); |
|
|
|
result["TenantId"].ShouldBe(_testTenantId.ToString()); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task Should_Use_Header_Tenant_Id_When_QueryString_Tenant_Is_Empty() |
|
|
|
{ |
|
|
|
Client.DefaultRequestHeaders.Add(_options.TenantKey, _testTenantId.ToString()); |
|
|
|
|
|
|
|
var result = await GetResponseAsObjectAsync<Dictionary<string, string>>($"http://abp.io?{_options.TenantKey}="); |
|
|
|
result["TenantId"].ShouldBe(_testTenantId.ToString()); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task Should_Fallback_To_Host_When_QueryString_Tenant_Is_Empty_And_No_Other_Resolver() |
|
|
|
{ |
|
|
|
var result = await GetResponseAsObjectAsync<Dictionary<string, string>>($"http://abp.io?{_options.TenantKey}="); |
|
|
|
result["TenantId"].ShouldBe(""); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task Should_Use_Header_Tenant_Id_When_QueryString_Tenant_Is_Whitespace() |
|
|
|
{ |
|
|
|
Client.DefaultRequestHeaders.Add(_options.TenantKey, _testTenantId.ToString()); |
|
|
|
|
|
|
|
var result = await GetResponseAsObjectAsync<Dictionary<string, string>>($"http://abp.io?{_options.TenantKey}=%20"); |
|
|
|
result["TenantId"].ShouldBe(_testTenantId.ToString()); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task Should_Fallback_To_Host_When_QueryString_Tenant_Is_Whitespace_And_No_Other_Resolver() |
|
|
|
{ |
|
|
|
var result = await GetResponseAsObjectAsync<Dictionary<string, string>>($"http://abp.io?{_options.TenantKey}=%20"); |
|
|
|
result["TenantId"].ShouldBe(""); |
|
|
|
} |
|
|
|
} |
|
|
|
|