Kaylumah.Testing.Azurite
1.0.3
See the version list below for details.
dotnet add package Kaylumah.Testing.Azurite --version 1.0.3
NuGet\Install-Package Kaylumah.Testing.Azurite -Version 1.0.3
<PackageReference Include="Kaylumah.Testing.Azurite" Version="1.0.3" />
paket add Kaylumah.Testing.Azurite --version 1.0.3
#r "nuget: Kaylumah.Testing.Azurite, 1.0.3"
// Install Kaylumah.Testing.Azurite as a Cake Addin #addin nuget:?package=Kaylumah.Testing.Azurite&version=1.0.3 // Install Kaylumah.Testing.Azurite as a Cake Tool #tool nuget:?package=Kaylumah.Testing.Azurite&version=1.0.3
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 anAzuriteAccount
- Configure an
- Create SDK clients from
AzuriteAccount
- Supports
BlobServiceClient
- Supports
TableServiceClient
- Supports
QueueServiceClient
- Supports
- Create SDK clients using
ConnectionString
SharedKeyCredential
TokenCredential
AzureSasCredential
License
This repo is licensed under the MIT License
Product | Versions 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. |
-
net6.0
- Azure.Data.Tables (>= 12.7.1)
- Azure.Identity (>= 1.8.0)
- Azure.Storage.Blobs (>= 12.14.1)
- Azure.Storage.Queues (>= 12.12.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.