Kaylumah.Testing.Azurite 1.0.4

dotnet add package Kaylumah.Testing.Azurite --version 1.0.4                
NuGet\Install-Package Kaylumah.Testing.Azurite -Version 1.0.4                
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="Kaylumah.Testing.Azurite" Version="1.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Kaylumah.Testing.Azurite --version 1.0.4                
#r "nuget: Kaylumah.Testing.Azurite, 1.0.4"                
#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 Kaylumah.Testing.Azurite as a Cake Addin
#addin nuget:?package=Kaylumah.Testing.Azurite&version=1.0.4

// Install Kaylumah.Testing.Azurite as a Cake Tool
#tool nuget:?package=Kaylumah.Testing.Azurite&version=1.0.4                

Kaylumah.Testing.Azurite

This package aims to provide a set of test utility classes for applications using the Azure SDK for dotnet. Specifically, it provides access to Azure Storage APIs via Azurite.

Description

Azurite emulates Azure Blob, Azure Table and Azure Queue storage APIs. It can be run via NPM or as a Docker container. Azurite has a lot of configuration options, so we cannot assume how it is running.

The package offers an AzuriteAccount class that provides access to the connection information. For example, if you started Azurite without any options, you can create an AzuriteAccount like this:

[Fact]
public void TestDefaultHttpConnectionString()
{
    AzuriteAccount account = AzuriteHelper.CreateDefaultAzuriteAccountBuilder();
    account.ConnectionString
        .Should()
        .BeEquivalentTo(
            "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;");
}

For convenience, the package offers methods to create SDK clients.

For Table Storage

[Fact(Timeout = 300_000)]
public async Task TestCanConnectToTableServiceViaConnectionString()
{
    AzuriteAccount account = AzuriteHelper.CreateDefaultAzuriteAccountBuilder();
    var tableServiceClient = account.CreateTableServiceClient(AzuriteConnectionMode.ConnectionString);
    var properties = await tableServiceClient.GetPropertiesAsync();
    properties.GetRawResponse().Status.Should().Be(200);
}

For Blob Storage

[Fact(Timeout = 300_000)]
public async Task TestCanConnectToBlobServiceViaConnectionString()
{
    AzuriteAccount account = AzuriteHelper.CreateDefaultAzuriteAccountBuilder();
    var blobServiceClient = account.CreateBlobServiceClient(AzuriteConnectionMode.ConnectionString);
    var properties = await blobServiceClient.GetPropertiesAsync();
    properties.GetRawResponse().Status.Should().Be(200);
}

For Queue Storage

[Fact(Timeout = 300_000)]
public async Task TestCanConnectToQueueServiceViaConnectionString()
{
    AzuriteAccount account = AzuriteHelper.CreateDefaultAzuriteAccountBuilder();
    var queueServiceClient = account.CreateQueueServiceClient(AzuriteConnectionMode.ConnectionString);
    var properties = await queueServiceClient.GetPropertiesAsync();
    properties.GetRawResponse().Status.Should().Be(200);
}

Features

  • Does not assume how Azurite is running
    • Configure an AzuriteAccountBuilder to create an AzuriteAccount
  • Create SDK clients from AzuriteAccount
    • Supports BlobServiceClient
    • Supports TableServiceClient
    • Supports QueueServiceClient
  • Create SDK clients using
    • ConnectionString
    • SharedKeyCredential
    • TokenCredential
    • AzureSasCredential

License

This repo is licensed under the MIT License

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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
1.0.4 5,313 2/10/2023
1.0.3 2,768 11/30/2022
1.0.2 378 11/4/2022
1.0.1 699 10/13/2022
1.0.0 461 9/17/2022