diff --git a/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AbpBlobStoringAzureModule.cs b/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AbpBlobStoringAzureModule.cs index a7a935abf5..0b386fbec1 100644 --- a/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AbpBlobStoringAzureModule.cs +++ b/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AbpBlobStoringAzureModule.cs @@ -2,9 +2,7 @@ namespace Volo.Abp.BlobStoring.Azure { - [DependsOn( - typeof(AbpBlobStoringModule) - )] + [DependsOn(typeof(AbpBlobStoringModule))] public class AbpBlobStoringAzureModule : AbpModule { diff --git a/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs index d43fbb2158..eb69bb802a 100644 --- a/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Azure/Volo/Abp/BlobStoring/Azure/AzureBlobProvider.cs @@ -45,7 +45,6 @@ namespace Volo.Abp.BlobStoring.Azure } var download = await blobClient.DownloadAsync(); - var memoryStream = new MemoryStream(); await download.Value.Content.CopyToAsync(memoryStream); return memoryStream; @@ -65,8 +64,7 @@ namespace Volo.Abp.BlobStoring.Azure private static async Task BlobExistsAsync(BlobClient blobClient) { - var response = await blobClient.ExistsAsync(); - return response.Value; + return (await blobClient.ExistsAsync()).Value; } } } diff --git a/framework/test/Volo.Abp.BlobStoring.Azure.Tests/Volo/Abp/BlobStoring/Azure/AbpBlobStoringAzureTestModule.cs b/framework/test/Volo.Abp.BlobStoring.Azure.Tests/Volo/Abp/BlobStoring/Azure/AbpBlobStoringAzureTestModule.cs index 4a1b0f8114..4711699726 100644 --- a/framework/test/Volo.Abp.BlobStoring.Azure.Tests/Volo/Abp/BlobStoring/Azure/AbpBlobStoringAzureTestModule.cs +++ b/framework/test/Volo.Abp.BlobStoring.Azure.Tests/Volo/Abp/BlobStoring/Azure/AbpBlobStoringAzureTestModule.cs @@ -12,7 +12,9 @@ namespace Volo.Abp.BlobStoring.Azure )] public class AbpBlobStoringAzureTestModule : AbpModule { - public static string UserSecretsId = "9f0d2c00-80c1-435b-bfab-2c39c8249091"; + private const string UserSecretsId = "9f0d2c00-80c1-435b-bfab-2c39c8249091"; + + private string _connectionString; private readonly string _randomContainerName = "abp-azure-test-container-" + Guid.NewGuid().ToString("N"); @@ -25,7 +27,9 @@ namespace Volo.Abp.BlobStoring.Azure var configuration = context.Services.GetConfiguration(); - var blobServiceClient = new BlobServiceClient(configuration["Azure:ConnectionString"]); + _connectionString = configuration["Azure:ConnectionString"]; + + var blobServiceClient = new BlobServiceClient(_connectionString); blobServiceClient.CreateBlobContainer(_randomContainerName); Configure(options => @@ -34,7 +38,7 @@ namespace Volo.Abp.BlobStoring.Azure { containerConfiguration.UseAzure(azure => { - azure.ConnectionString = configuration["Azure:ConnectionString"]; + azure.ConnectionString = _connectionString; azure.ContainerName = _randomContainerName; }); }); @@ -44,7 +48,7 @@ namespace Volo.Abp.BlobStoring.Azure public override void OnApplicationShutdown(ApplicationShutdownContext context) { var configuration = context.ServiceProvider.GetRequiredService(); - var blobServiceClient = new BlobServiceClient(configuration["Azure:ConnectionString"]); + var blobServiceClient = new BlobServiceClient(_connectionString); blobServiceClient.DeleteBlobContainer(_randomContainerName); } } diff --git a/framework/test/Volo.Abp.BlobStoring.Azure.Tests/Volo/Abp/BlobStoring/Azure/AzureBlobContainer_Tests.cs b/framework/test/Volo.Abp.BlobStoring.Azure.Tests/Volo/Abp/BlobStoring/Azure/AzureBlobContainer_Tests.cs index 75070d2cac..751918be85 100644 --- a/framework/test/Volo.Abp.BlobStoring.Azure.Tests/Volo/Abp/BlobStoring/Azure/AzureBlobContainer_Tests.cs +++ b/framework/test/Volo.Abp.BlobStoring.Azure.Tests/Volo/Abp/BlobStoring/Azure/AzureBlobContainer_Tests.cs @@ -1,9 +1,10 @@ using Xunit; -//#define I_HAVE_SET_THE_CORRECT_CONNECTIONSTRING_IN_THE_USERSECRETS_FILE namespace Volo.Abp.BlobStoring.Azure { -#if I_HAVE_SET_THE_CORRECT_CONNECTION_STRING_IN_THE_USERSECRETS_FILE + /* + //Please set the correct connection string in secrets.json and continue the test. + public class AzureBlobContainer_Tests : BlobContainer_Tests { public AzureBlobContainer_Tests() @@ -11,5 +12,5 @@ namespace Volo.Abp.BlobStoring.Azure } } -#endif + */ }