Browse Source

Added test: Default_Settings_With_TenantId

pull/4105/head
Halil İbrahim Kalkan 6 years ago
parent
commit
c2fa54729d
  1. 27
      framework/test/Volo.Abp.BlobStoring.FileSystem.Tests/Volo/Abp/BlobStoring/FileSystem/BlogFilePathCalculator_Tests.cs

27
framework/test/Volo.Abp.BlobStoring.FileSystem.Tests/Volo/Abp/BlobStoring/FileSystem/BlogFilePathCalculator_Tests.cs

@ -8,7 +8,7 @@ namespace Volo.Abp.BlobStoring.FileSystem
public class BlogFilePathCalculator_Tests : AbpBlobStoringFileSystemTestBase public class BlogFilePathCalculator_Tests : AbpBlobStoringFileSystemTestBase
{ {
private readonly IBlogFilePathCalculator _calculator; private readonly IBlogFilePathCalculator _calculator;
public BlogFilePathCalculator_Tests() public BlogFilePathCalculator_Tests()
{ {
_calculator = GetRequiredService<IBlogFilePathCalculator>(); _calculator = GetRequiredService<IBlogFilePathCalculator>();
@ -18,26 +18,37 @@ namespace Volo.Abp.BlobStoring.FileSystem
public void Default_Settings() public void Default_Settings()
{ {
var separator = Path.DirectorySeparatorChar; var separator = Path.DirectorySeparatorChar;
_calculator.Calculate( _calculator.Calculate(
GetArgs($"C:{separator}my-files","my-container","my-blob") GetArgs($"C:{separator}my-files", "my-container", "my-blob")
).ShouldBe($"C:{separator}my-files{separator}host{separator}my-container{separator}my-blob"); ).ShouldBe($"C:{separator}my-files{separator}host{separator}my-container{separator}my-blob");
} }
[Fact]
public void Default_Settings_With_TenantId()
{
var separator = Path.DirectorySeparatorChar;
var tenantId = Guid.NewGuid();
_calculator.Calculate(
GetArgs($"C:{separator}my-files", "my-container", "my-blob", tenantId: tenantId)
).ShouldBe($"C:{separator}my-files{separator}tenants{separator}{tenantId:D}{separator}my-container{separator}my-blob");
}
[Fact] [Fact]
public void AppendContainerNameToBasePath_Set_To_False() public void AppendContainerNameToBasePath_Set_To_False()
{ {
var separator = Path.DirectorySeparatorChar; var separator = Path.DirectorySeparatorChar;
_calculator.Calculate( _calculator.Calculate(
GetArgs($"C:{separator}my-files","my-container","my-blob", appendContainerNameToBasePath: false) GetArgs($"C:{separator}my-files", "my-container", "my-blob", appendContainerNameToBasePath: false)
).ShouldBe($"C:{separator}my-files{separator}host{separator}my-blob"); ).ShouldBe($"C:{separator}my-files{separator}host{separator}my-blob");
} }
private BlobProviderArgs GetArgs( private BlobProviderArgs GetArgs(
string basePath, string basePath,
string containerName, string containerName,
string blobName, string blobName,
Guid? tenantId = null, Guid? tenantId = null,
bool? appendContainerNameToBasePath = null) bool? appendContainerNameToBasePath = null)
{ {

Loading…
Cancel
Save