DevelopmentHelpers.Storage.Core 6.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package DevelopmentHelpers.Storage.Core --version 6.0.3
NuGet\Install-Package DevelopmentHelpers.Storage.Core -Version 6.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DevelopmentHelpers.Storage.Core" Version="6.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DevelopmentHelpers.Storage.Core --version 6.0.3
#r "nuget: DevelopmentHelpers.Storage.Core, 6.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DevelopmentHelpers.Storage.Core as a Cake Addin
#addin nuget:?package=DevelopmentHelpers.Storage.Core&version=6.0.3

// Install DevelopmentHelpers.Storage.Core as a Cake Tool
#tool nuget:?package=DevelopmentHelpers.Storage.Core&version=6.0.3

DevelopmentHelpers.Storage.Core

This library allows easier access to Azure Storage and Azure FileShare as well as Local directory sturcture. With few command you can upload or download entire sturucture to local or Azure storage.

Code Example

Following example shows how to use Azure Storage Classes

  1. Create IStorage -- IStorage interface has two implementation local & Azure: use any dependency injection container IStorage storage = new AzureStorage(config,logger); or IStorage storage = new FileSystemStorage(config,logger);

  2. Create IAzureFileStorage to use FileShare use dependency injection container services.AddAzureStorage(configuration); where configuration is IConfiguration or IAzureFileStorage fileStorage = new AzureFileStorage(AzureFileStorageConfiguration,logger);

  3. Use methods available on the interface: e.g: UploadDirectoryAsync(DirectoryInfo directory, string container);

  4. To Add in the Web Application

    1. Create Appsettings
      "DevelopmentHelpers": { "AzureConfiguration": { "AccountName": "Account-Name", "AccountKey": "Account-Key", "UseHttps": "True" }, "AzureFileStorageConfiguration": { "ConnectionString": "Connection-String", "ShareName": "Share-Name" } }

    2. Add in the Startup file //Add Azure Storage and make sure required values exists in app settings services.AddAzureStorage(Configuration);

    3. To Use it private readonly IStorage _storage; private readonly IAzureFileStorage _fileStorage; public IndexModel(IStorage storage,IAzureFileStorage fileStorage) { _storage = storage; _fileStorage= fileStorage; }

    4. Added Capability to sync containers, this is useful if you want to sync containers between regiosn [TestMethod] [DataTestMethod] [DataRow("source","target")] public async Task SyncContainersTestWhenTargetDoesnotExistAsync(string sourceContainerName, string targetContainerName) { AzureStorage azureStorage = new(new Models.AzureConfiguration { AccountKey = ConfigHelper.Instance.AzureConfiguration.AccountKey, AccountName = ConfigHelper.Instance.AzureConfiguration.AccountName, UseHttps = true }, ConfigHelper.Instance.LoggerFactory.CreateLogger<AzureStorage>());

       string tempDirectoryPath = Path.Combine(_localDirectoryPath, sourceContainerName);
       if (Directory.Exists(tempDirectoryPath))
       {
           Directory.Delete(tempDirectoryPath, true);
       }
      
      
       if (!await azureStorage.ContainerExistsAsync(sourceContainerName))
       {
           var tempPath = _dirHelper.CreateTempDirectory(tempDirectoryPath);
           _ = await azureStorage.UploadDirectoryAsync(tempPath, sourceContainerName);
       }
      
       AzureStorageSyncHelper syncHelper = new(azureStorage, azureStorage);
       var (Success, _) = await syncHelper.SyncContainersAsync(sourceContainerName, targetContainerName, false, _localDirectoryPath);
       Assert.IsTrue(Success);
      

      } [TestMethod] [DataTestMethod] [DataRow("source", "target")] public async Task SyncContainersTestWhenTargetExistAsync(string sourceContainerName, string targetContainerName) { AzureStorage azureStorage = new(new Models.AzureConfiguration { AccountKey = ConfigHelper.Instance.AzureConfiguration.AccountKey, AccountName = ConfigHelper.Instance.AzureConfiguration.AccountName, UseHttps = true }, ConfigHelper.Instance.LoggerFactory.CreateLogger<AzureStorage>());

       string tempDirectoryPath = Path.Combine(_localDirectoryPath, sourceContainerName);
       if (Directory.Exists(tempDirectoryPath))
       {
           Directory.Delete(tempDirectoryPath, true);
       }
      
      
       if (!await azureStorage.ContainerExistsAsync(sourceContainerName))
       {
           var tempPath = _dirHelper.CreateTempDirectory(tempDirectoryPath);
           _ = await azureStorage.UploadDirectoryAsync(tempPath, sourceContainerName);
           _ = await azureStorage.UploadDirectoryAsync(tempPath, targetContainerName);
      
           string fileName = $"deleteme.txt";
           FileHelper fileHelper = new(tempDirectoryPath);
           fileHelper.CreateFile(1024, fileName);
           FileInfo fileInfo = new(Path.Combine(tempDirectoryPath, fileName));
           await azureStorage.UploadFileAsync(fileInfo, MimeTypes.txt, targetContainerName);
       }
      
       AzureStorageSyncHelper syncHelper = new(azureStorage, azureStorage);
       var (Success, Message) = await syncHelper.SyncContainersAsync(sourceContainerName, targetContainerName, false, _localDirectoryPath);
       Assert.IsNotNull(Message);
       Assert.IsTrue(Success);
      

      }

Motivation

I needed a consistent and easy to use library in .net Standard which I can use it with any project, and be able to download and upload complete directories.

API Reference

Tests

Describe and show how to run the tests with code examples. Tests are as follows: AzureTest

/*************************** AzureStorageTest ************************* using System; using System.Collections.Generic; using System.IO; using Azure.Storage.Blobs.Models; using DevelopmentHelpers.Storage.Core.Helpers; using DevelopmentHelpers.Storage.Core.Implementations.Azure; using DevelopmentHelpers.Storage.Core.Interfaces; using DevelopmentHelpers.Storage.Core.Tests.Helpers; using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DevelopmentHelpers.Storage.Core.Tests { [TestClass] public class AzureStorageCoreTest {

    [AssemblyInitialize]
    public static void AssemblyInit(TestContext context)
    {
        Console.WriteLine("AssemblyInit " + context.TestName);
    }
    static IStorage _storage;
    static StringHelper _stringHelper;
    private static string _localDirectoryPath;
    static DirectoryHelper _dirHelper;
    [ClassInitialize]
    public static void AzureStorageTestInit(TestContext context)
    {
        _storage = new AzureStorage(ConfigHelper.Instance.AzureConfiguration, ConfigHelper.Instance.LoggerFactory.CreateLogger<AzureStorage>());
        _stringHelper = new StringHelper();
        _dirHelper = new DirectoryHelper();
        _localDirectoryPath = Path.Combine("C:\\temp", "AzureStorageCoreTest");
        if (Directory.Exists(_localDirectoryPath))
        {
            Directory.Delete(_localDirectoryPath, true);
        }
        Directory.CreateDirectory(_localDirectoryPath);
        Console.WriteLine("AzureStorageTestInit " + context.TestName);
    }
    [TestMethod]
    public void ValidateTest()
    {
        Assert.IsTrue(_storage.Validate());
    }
    [TestMethod]
    public void CreateContainerAndDeleteContainerTest()
    {
        string testContainerName = $"{Guid.NewGuid():N}";
        var response = _storage.CreateContainerAsync(testContainerName, false).Result;
        Assert.IsNotNull(response);
        Assert.IsTrue(_storage.DeleteAsync(testContainerName).Result);
    }
    [TestMethod]
    [DataRow(1, 1024)]
    [DataRow(1, 36870637)]
    public void AzureUploadFileInfoTest(int count, long size)
    {

        string containerName = $"{Guid.NewGuid():N}";
        string tempDirectoryPath = Path.Combine(_localDirectoryPath, containerName);
        FileHelper fileHelper = new FileHelper(tempDirectoryPath);
        for (int i = 0; i < count; i++)
        {
            string fileName = $"{Guid.NewGuid()}.txt";
            fileHelper.CreateFile(size, fileName);
            FileInfo fileInfo = new FileInfo(Path.Combine(tempDirectoryPath, fileName));
            Assert.IsNotNull(_storage.UploadFileAsync(fileInfo, MimeTypes.txt, containerName).Result);
            var blobUri = _storage.GetUri(containerName, fileName);
            Assert.IsNotNull(blobUri);
        }
    }
    [TestMethod]
    [DataRow(1, 1024)]
    [DataRow(1, 36870637)]
    [DataRow(1, 536870637)]
    [DataRow(1, 1073741824)] //1 GB 
    [DataRow(1, 2147483648)]// 2 GB
    [DataRow(1, 5368709120)]// 5 gb
    [DataRow(1, 10737418240)]// 10 GB
    public void AzureUploadFileInChunksTest(int count, long size)
    {
        string containerName = $"{Guid.NewGuid():N}";
        string tempDirectoryPath = Path.Combine(_localDirectoryPath, containerName);
        FileHelper fileHelper = new FileHelper(tempDirectoryPath);
        for (int i = 0; i < count; i++)
        {
            string fileName = $"{Guid.NewGuid()}.txt";
            fileHelper.CreateFile(size, fileName);
            string completeFilePath = Path.Combine(tempDirectoryPath, fileName);
            var uri = _storage.UploadInChunks(completeFilePath, containerName, fileName, MimeTypes.txt).Result;
            Assert.IsNotNull(uri);      
        } 
    }
    [TestMethod]
    [DataRow(1, 1024)]
    [DataRow(1, 36870637)]
    [DataRow(1, 536870637)]
    //[DataRow(1, 1073741824)] //1 GB 
    //[DataRow(1, 2147483648)]// 2 GB
    //[DataRow(1, 5368709120)]// 5 gb
    //[DataRow(1, 10737418240)]// 10 GB
    public void AzureDownloadFileTest(int count, long size)
    {

        string containerName = $"{Guid.NewGuid():N}";
        string tempDirectoryPath = Path.Combine(_localDirectoryPath, containerName);
        string downloadDirectoryPath = Path.Combine(_localDirectoryPath, $"{Guid.NewGuid():N}");
        Directory.CreateDirectory(downloadDirectoryPath);
        FileHelper fileHelper = new FileHelper(tempDirectoryPath);
        for (int i = 0; i < count; i++)
        {
            string fileName = $"{Guid.NewGuid()}.txt";
            fileHelper.CreateFile(size, fileName);
            FileInfo fileInfo = new FileInfo(Path.Combine(tempDirectoryPath, fileName));
            Assert.IsNotNull(_storage.UploadFileAsync(fileInfo, MimeTypes.txt, containerName).Result);
            var blobUri = _storage.GetUri(containerName, fileName);
            Assert.IsNotNull(blobUri); 
            //Download
            var file = _storage.DownloadToFileAsync(blobUri, downloadDirectoryPath).Result;
            Assert.IsNotNull(file);
        }
    }



    [TestMethod]
    public void AzureDownloadFileTest()
    {
        string containerName = $"{Guid.NewGuid():N}";
        string tempDirectoryPath = Path.Combine(_localDirectoryPath, containerName);
        Directory.CreateDirectory(tempDirectoryPath);
        string testfile = Path.Combine(tempDirectoryPath, $"{Guid.NewGuid()}.txt");
        _stringHelper.CreatetestFile(testfile);
        FileInfo fileInfo = new FileInfo(testfile);
        var url = _storage.UploadFileAsync(fileInfo, MimeTypes.txt, containerName).Result;
        var file = _storage.DownloadToFileAsync(url, tempDirectoryPath).Result;
        Assert.IsNotNull(file);
    }
    

    [TestMethod]
    public void AzureDownloadToStreamAsyncTest()
    {
        string containerName = $"{Guid.NewGuid():N}";
        string tempDirectoryPath = Path.Combine(_localDirectoryPath, containerName);
        Directory.CreateDirectory(tempDirectoryPath);
        string testfile = Path.Combine(tempDirectoryPath, $"{Guid.NewGuid()}.txt");
        _stringHelper.CreatetestFile(testfile);
        FileInfo fileInfo = new FileInfo(testfile);
        var url = _storage.UploadFileAsync(fileInfo, MimeTypes.txt, containerName).Result;
        var file = _storage.DownloadToStreamAsync(url, tempDirectoryPath);
        Assert.IsNotNull(file);
    }


    [TestMethod]
    public void GetStorageContainerTest()
    {
        string tempDirectory = $"{Guid.NewGuid():N}";
        string tempDirectoryPath = Path.Combine(_localDirectoryPath, tempDirectory);
        _dirHelper.CreateTempDirectory(tempDirectoryPath); 
        var storageContainer = _storage.GetStorageContainerAsync(tempDirectory).Result;
        Assert.IsNotNull(storageContainer);
    }

    [TestMethod]
    public void DownloadContainerTest()
    {
        string containerName = $"{Guid.NewGuid():N}";
        string tempDirectoryPath = Path.Combine(_localDirectoryPath, containerName);
        _dirHelper.CreateTempDirectory(tempDirectoryPath);
        //Upload the directory 
        var created = _storage.UploadDirectoryAsync(tempDirectoryPath, containerName).Result;
        Assert.IsNotNull(created);  
        string downloadDirectory = $"{Guid.NewGuid():N}";
        string downloadDirectoryPath = Path.Combine(_localDirectoryPath, downloadDirectory);
        bool result = _storage.DownloadContainer(containerName, downloadDirectoryPath).Result;
        Assert.IsTrue(result);
    }
    [TestMethod]
    public void AzureUploadDirectoryAndZipAsyncTest()
    {
        string containerName = $"{Guid.NewGuid():N}"; 
        string tempDirectoryPath = Path.Combine(_localDirectoryPath, containerName);
        var tempPath = _dirHelper.CreateTempDirectory(tempDirectoryPath);
        DirectoryInfo info = new DirectoryInfo(tempPath);
        var created = _storage.UploadDirectoryAsync(info, containerName).Result;
        Assert.IsNotNull(created); 
        string zipFolder = "Zip";
        string zipFolderPath = Path.Combine(_localDirectoryPath, zipFolder);
        if (!Directory.Exists(zipFolderPath))
            Directory.CreateDirectory(zipFolderPath);
        var zipFile = _storage.CreateZipFromContainerAsync(info.Name, zipFolderPath, $"{containerName}.zip")
            .Result;
        Assert.IsNotNull(zipFile);
    }

    [TestMethod]
    public void AzureDownloadStorageContainerTest()
    {
        string containerName = $"{Guid.NewGuid():N}";
        string tempDirectoryPath = Path.Combine(_localDirectoryPath, containerName);
        var tempPath = _dirHelper.CreateTempDirectory(tempDirectoryPath);
        DirectoryInfo info = new DirectoryInfo(tempPath);
        var created = _storage.UploadDirectoryAsync(info, containerName).Result;
        Assert.IsNotNull(created);

        var storageContainer = _storage.GetStorageContainerAsync(containerName).Result;
        Assert.IsNotNull(storageContainer);

    }


    [TestMethod]
    public void AzureSystemUploadFileAsyncInfoTest()
    {
        //Test File 
        string fileName = $"{Guid.NewGuid()}.txt";
        string testFile = Path.Combine(Path.GetTempPath(), fileName);
        _stringHelper.CreatetestFile(testFile);
        FileInfo fileInfo = new FileInfo(testFile);
        //Container 
        string containerName = $"{Guid.NewGuid():N}";
        var url = _storage.UploadFileAsync(fileInfo, MimeTypes.txt, containerName).Result;
        Assert.IsNotNull(url);
        Assert.IsNotNull(_storage.GetUri(containerName, fileName));
        var file = _storage.DownloadToFileAsync(url, _localDirectoryPath).Result;
        Assert.IsNotNull(file);
        var stream = _storage.DownloadToStreamAsync(url, _localDirectoryPath).Result;
        var tempFilePath = Path.Combine(_localDirectoryPath, "test.txt");
        if (File.Exists(tempFilePath))
            File.Delete(tempFilePath);
        using (FileStream fileStream = new FileStream(tempFilePath, FileMode.Create, FileAccess.Write))
        {
            byte[] bytes = new byte[stream.Length];
            stream.Read(bytes, 0, (int)stream.Length);
            fileStream.Write(bytes, 0, bytes.Length);
            stream.Close();
        }
        Assert.IsNotNull(stream);
    }



    [TestMethod]
    public void CreateLargeFileZipTest()
    {
        //Create local Temp Directory where Container will be downloaded
        string zipFolder = "LargeFolder";
        string zipFolderPath = Path.Combine(_localDirectoryPath, zipFolder);
        if (Directory.Exists(zipFolderPath))
            Directory.Delete(zipFolderPath, true);


        //Create and upload temp directory to Azure Container
        string tempContainer = $"{Guid.NewGuid():N}";
        string tempDirectoryPath = Path.Combine(_localDirectoryPath, tempContainer);
        var tempPath = _dirHelper.CreateTempDirectory(tempDirectoryPath, 1);
        DirectoryInfo info = new DirectoryInfo(tempPath);
        var uploaded = _storage.UploadDirectoryAsync(info, tempContainer).Result;
        Assert.IsNotNull(uploaded);


        var zipFile = _storage.CreateZipFromContainerAsync(tempContainer, zipFolderPath, $"{tempContainer}.zip")
            .Result;
        Assert.IsNotNull(zipFile);
    }



  


    [TestMethod]
    public void AzureGetContainerTest()
    {

        var blobContainerList = _storage.GetContainersAsync().Result;
        Assert.IsInstanceOfType(blobContainerList, typeof(List<BlobContainerItem>));
        Assert.IsTrue(true);
    }
    //
    [TestMethod]
    [DataRow(5, 1024)] 
    public void ListBlobsAsyncTest(int count, long size)
    {

        string containerName = $"{Guid.NewGuid():N}";
        string tempDirectoryPath = Path.Combine(_localDirectoryPath, containerName);
        FileHelper fileHelper = new FileHelper(tempDirectoryPath);
        for (int i = 0; i < count; i++)
        {
            string fileName = $"{Guid.NewGuid()}.txt";
            fileHelper.CreateFile(size, fileName);
        }
        DirectoryInfo infos = new DirectoryInfo(tempDirectoryPath);
        foreach (var fileInfo in infos.GetFiles())
        {
            var url = _storage.UploadFileAsync(fileInfo, MimeTypes.txt, containerName).Result;
            Assert.IsNotNull(url);
        }

        var blobItems = _storage.ListBlobsAsync(containerName).Result;
        Assert.IsInstanceOfType(blobItems, typeof(List<BlobItem>));
        //Delete the container 
        _storage.DeleteAsync(containerName);
        Assert.IsTrue(true);
    }
    [TestMethod]
    public void LocalGetContainerTest()
    {
        //Create local Temp Directory where Container will be downloaded
        string localTempDirectoryDownload = "localTempDirectoryDownload";
        string localTempDirectoryDownloadPath = Path.Combine(_localDirectoryPath, localTempDirectoryDownload);
        if (Directory.Exists(localTempDirectoryDownloadPath))
            Directory.Delete(localTempDirectoryDownloadPath);
        //Create and upload temp directory to Azure Container
        string tempContainer = $"{Guid.NewGuid():N}";
        string tempDirectoryPath = Path.Combine(_localDirectoryPath, tempContainer);
        var tempPath = _dirHelper.CreateTempDirectory(tempDirectoryPath);
        DirectoryInfo info = new DirectoryInfo(tempPath);
        var created = _storage.UploadDirectoryAsync(info, tempContainer).Result;
        Assert.IsNotNull(created);
        var storageContainer = _storage.GetStorageContainerAsync(tempContainer).Result;
        Assert.IsNotNull(storageContainer);
        //Save Container to Local Directory
        var localSavedPath = _storage.SaveStorageContainerAsync(storageContainer, localTempDirectoryDownloadPath).Result;
        Assert.IsNotNull(localSavedPath);
    }

    [ClassCleanup]
    public static void ClassCleanup()
    {
        var containers = _storage.GetContainersAsync().Result;
        foreach (BlobContainerItem container in containers)
        {
            var deleted = _storage.DeleteAsync(container.Name).Result;
            Assert.IsTrue(deleted);
        }
        //Delete temp directory
        if (Directory.Exists(_localDirectoryPath))
            Directory.Delete(_localDirectoryPath, true);
        Console.WriteLine("AzureStorageTestInit Cleanup");
    }
    [AssemblyCleanup]
    public static void AssemblyCleanup()
    {
        Console.WriteLine("Assembly Cleanup");
    }

}

[TestClass]
public class AzureFileStorageTests
{
    static ILogger<AzureFileStorageTests> _logger;
    static IAzureFileStorage _azureFileStorageHelper;
    static readonly string _shareName = ConfigHelper.Instance.AzureFileStorageConfiguration.ShareName;
    static string _localDirectoryPath;
    static string _localDownloadDirectoryPath;
    static DirectoryHelper _dirHelper;
    [ClassInitialize]
    public static void ClassInitialize(TestContext context)
    {
        _logger = ConfigHelper.Instance.LoggerFactory.CreateLogger<AzureFileStorageTests>();
        _logger.LogInformation("{test}", context.TestRunDirectory);
        _azureFileStorageHelper = new AzureFileStorage(ConfigHelper.Instance.AzureFileStorageConfiguration,
            ConfigHelper.Instance.LoggerFactory.CreateLogger<AzureFileStorage>());
        _localDirectoryPath = Path.Combine(ConfigHelper.TempFolderPath, _shareName);
        _dirHelper = new DirectoryHelper();
        if (!Directory.Exists(_localDirectoryPath))
        {
            Directory.CreateDirectory(_localDirectoryPath);
        }
        _localDownloadDirectoryPath = Path.Combine(ConfigHelper.TempFolderPath, "Download");
        if (!Directory.Exists(_localDownloadDirectoryPath))
        {
            Directory.CreateDirectory(_localDownloadDirectoryPath);
        }

        
    }
    
    [DataTestMethod]
    [DataRow(1024)]
    [DataRow(4194300)] //4mb
    [DataRow(36870637)]
    [DataRow(536870637)]
    [DataRow(1073741824)] //1 GB 
    [DataRow(2147483648)]// 2 GB
    [DataRow(5368709120)]// 5 gb
    [DataRow(10737418240)]// 10 GB

    public async Task UploadAndDownloadFileTest(long fileSize)
    {
        string directoryName = Guid.NewGuid().ToString();
        string fileName = $"{directoryName}_1.txt";
        string directoryPath = Path.Combine(_localDirectoryPath, directoryName);
        FileHelper _fileHelper = new(directoryPath);
        await _fileHelper.CreateFileAsync(fileSize, fileName);

        //upload to azure FileShare
        string filePath = Path.Combine(directoryPath, fileName);
        FileInfo fileInfo = new(filePath);
        var (isValidDirectory, message) = _azureFileStorageHelper.ValidateShareDirectoryOrShareFileName(fileInfo.Directory.Name);
        _logger.LogInformation("{message}", message);
        Assert.IsTrue(isValidDirectory);
        _ = await _azureFileStorageHelper.UploadFileAsync(fileInfo);
        bool fileExistsInShare = await _azureFileStorageHelper.FileExistsAsync(directoryName, fileName);
        Assert.IsTrue(fileExistsInShare);
        //Download the file 
        var downloadedFile = await _azureFileStorageHelper.DownloadAsync(fileName, directoryName, _localDownloadDirectoryPath);
        //Verify file exists
        Assert.IsTrue(File.Exists(downloadedFile)); 
        //Delete file from Share
        var (success,res) = await _azureFileStorageHelper.DeleteFileAsync(directoryName, fileName);
        Assert.IsTrue(success);
        _logger.LogInformation("{res}", res);

        bool deleteDirectory = await _azureFileStorageHelper.DeleteDirectoryAsync(directoryName);
        Assert.IsTrue(deleteDirectory);
        //Delete the local file 
        CleanTempDirectory(fileInfo);
        
    }


    [TestMethod]
    public async Task Get_AzureShare_Info_test()
    {
        AzureShareInfo info = await _azureFileStorageHelper.GetAzureShareInfo();
        Assert.IsNotNull(info);
        if (info != null && info.RootDirectory?.DirectoryList?.Count>0)
        {
            var directoryName = info.RootDirectory.DirectoryList[0].Name;
            AzureDirectoryInfo directoryInfo = await _azureFileStorageHelper.GetDirectoryInfoAsync(directoryName);
            Assert.IsNotNull(directoryInfo);
        }
    }
    [TestMethod]
    public async Task Directory_Download_Upload_Info_TestAsync()
    {
        string tempDirectory = $"{Guid.NewGuid():N}";
        string tempDirectoryPath = Path.Combine(_localDirectoryPath, tempDirectory);
        var tempPath= _dirHelper.CreateTempDirectory(tempDirectoryPath);
        DirectoryInfo info = new(tempPath);
        var created = await _azureFileStorageHelper.UploadDirectoryAsync(info, null);
        Assert.IsTrue(created);

        bool directoryExists = await _azureFileStorageHelper.DirectoryExistsAsync(tempDirectory);
        Assert.IsTrue(directoryExists);
        bool deleteDirectory = await _azureFileStorageHelper.DeleteDirectoryAsync(tempDirectory);
        Assert.IsTrue(deleteDirectory);
    }
    private static void CleanTempDirectory(FileInfo fileInfo)
    {
        try
        {
            if (Directory.Exists(fileInfo.DirectoryName))
            {
                Directory.Delete(fileInfo.DirectoryName, true);
            }
        }
        catch { }
    } 
    [ClassCleanup]
    public static void ClassCleanup()
    {

    }
}

}

*****************End FileSystemStorage Test/

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
7.0.11 79 5/31/2024
7.0.10 76 5/23/2024
7.0.9 70 5/23/2024
7.0.8 128 4/10/2024
7.0.7 82 2/16/2024
7.0.6 107 2/7/2024
7.0.5 87 1/29/2024
7.0.4 104 1/16/2024
7.0.3 126 12/26/2023
7.0.2 125 12/15/2023
7.0.1 98 12/15/2023
7.0.0 177 11/14/2023
6.0.5 158 10/23/2023
6.0.4 226 8/2/2023
6.0.3 121 7/27/2023
6.0.2 140 7/11/2023
6.0.1 143 6/22/2023
6.0.0 151 5/4/2023
5.0.3 182 4/27/2023
5.0.2 219 4/11/2023
5.0.1 250 2/22/2023
5.0.0 367 11/10/2022
4.0.11 326 11/10/2022
4.0.10 320 11/10/2022
4.0.9 434 9/6/2022
4.0.8 475 7/25/2022
4.0.7 423 7/25/2022
4.0.6 415 7/25/2022
4.0.5 445 7/14/2022
4.0.4 135 7/14/2022
4.0.3 532 3/24/2022
4.0.2 193 12/16/2021
4.0.1 154 12/16/2021
4.0.0 901 11/29/2021
3.0.3 581 10/15/2020
3.0.2 455 9/30/2020
3.0.1 428 9/29/2020
3.0.0 473 9/16/2020
2.0.2 603 7/8/2020
2.0.1 575 12/25/2019
2.0.0 495 12/25/2019
1.0.6 536 12/5/2019
1.0.5 634 6/2/2019
1.0.4 731 11/30/2018
1.0.3 760 11/12/2018
1.0.2 741 11/12/2018
1.0.1 723 11/12/2018
1.0.0 713 11/12/2018

update nuget and added blobExist method in IStorage