mirror of https://github.com/abpframework/abp.git
4 changed files with 162 additions and 35 deletions
@ -0,0 +1,13 @@ |
|||
using Xunit; |
|||
|
|||
namespace Volo.Abp.BlobStoring.Google; |
|||
|
|||
/* |
|||
//Please set the correct connection string in secrets.json and continue the test.
|
|||
public class GoogleBlobContainer_Tests : BlobContainer_Tests<AbpBlobStoringGoogleTestModule> |
|||
{ |
|||
public GoogleBlobContainer_Tests() |
|||
{ |
|||
} |
|||
} |
|||
*/ |
|||
@ -0,0 +1,56 @@ |
|||
using System; |
|||
using Shouldly; |
|||
using Volo.Abp.MultiTenancy; |
|||
using Xunit; |
|||
|
|||
namespace Volo.Abp.BlobStoring.Google; |
|||
|
|||
public class GoogleBlobNameCalculator_Tests : AbpBlobStoringGoogleTestCommonBase |
|||
{ |
|||
private readonly IGoogleBlobNameCalculator _calculator; |
|||
private readonly ICurrentTenant _currentTenant; |
|||
|
|||
private const string AzureContainerName = "/"; |
|||
private const string AzureSeparator = "/"; |
|||
|
|||
public GoogleBlobNameCalculator_Tests() |
|||
{ |
|||
_calculator = GetRequiredService<IGoogleBlobNameCalculator>(); |
|||
_currentTenant = GetRequiredService<ICurrentTenant>(); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Default_Settings() |
|||
{ |
|||
_calculator.Calculate( |
|||
GetArgs("my-container", "my-blob") |
|||
).ShouldBe($"host{AzureSeparator}my-blob"); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Default_Settings_With_TenantId() |
|||
{ |
|||
var tenantId = Guid.NewGuid(); |
|||
|
|||
using (_currentTenant.Change(tenantId)) |
|||
{ |
|||
_calculator.Calculate( |
|||
GetArgs("my-container", "my-blob") |
|||
).ShouldBe($"tenants{AzureSeparator}{tenantId:D}{AzureSeparator}my-blob"); |
|||
} |
|||
} |
|||
|
|||
private static BlobProviderArgs GetArgs( |
|||
string containerName, |
|||
string blobName) |
|||
{ |
|||
return new BlobProviderGetArgs( |
|||
containerName, |
|||
new BlobContainerConfiguration().UseGoogle(x => |
|||
{ |
|||
x.ContainerName = containerName; |
|||
}), |
|||
blobName |
|||
); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue