VOOZH about

URL: https://www.nuget.org/packages/AzureFunctions.TestFramework.Blob/

⇱ NuGet Gallery | AzureFunctions.TestFramework.Blob 0.14.0




AzureFunctions.TestFramework.Blob 0.14.0

dotnet add package AzureFunctions.TestFramework.Blob --version 0.14.0
 
 
NuGet\Install-Package AzureFunctions.TestFramework.Blob -Version 0.14.0
 
 
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="AzureFunctions.TestFramework.Blob" Version="0.14.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AzureFunctions.TestFramework.Blob" Version="0.14.0" />
 
Directory.Packages.props
<PackageReference Include="AzureFunctions.TestFramework.Blob" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AzureFunctions.TestFramework.Blob --version 0.14.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AzureFunctions.TestFramework.Blob, 0.14.0"
 
 
#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.
#:package AzureFunctions.TestFramework.Blob@0.14.0
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AzureFunctions.TestFramework.Blob&version=0.14.0
 
Install as a Cake Addin
#tool nuget:?package=AzureFunctions.TestFramework.Blob&version=0.14.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

AzureFunctions.TestFramework.Blob

👁 NuGet

BlobTrigger and BlobInput support for the Azure Functions Test Framework. Provides:

  • InvokeBlobAsync(...) — trigger blob-triggered functions directly from tests.
  • WithBlobInputContent(...) — inject fake blob content for functions that use [BlobInput] (non-trigger input binding).

BlobTrigger invocation

using AzureFunctions.TestFramework.Blob;
using AzureFunctions.TestFramework.Core;

public class BlobFunctionTests : IAsyncLifetime
{
 private IFunctionsTestHost _testHost;

 public async Task InitializeAsync()
 {
 _testHost = await new FunctionsTestHostBuilder()
 .WithFunctionsAssembly(typeof(MyBlobFunction).Assembly)
 .BuildAndStartAsync();
 }

 [Fact]
 public async Task ProcessBlob_WithTextContent_Succeeds()
 {
 var content = BinaryData.FromString("Hello from blob!");
 var result = await _testHost.InvokeBlobAsync("ProcessBlob", content, blobName: "test/file.txt");
 Assert.True(result.Success);
 }

 [Fact]
 public async Task ProcessBlob_WithJsonContent_Succeeds()
 {
 var content = BinaryData.FromObjectAsJson(new { id = "123", name = "test" });
 var result = await _testHost.InvokeBlobAsync(
 "ProcessBlob", content,
 blobName: "orders/order-123.json",
 containerName: "orders");
 Assert.True(result.Success);
 }

 public async Task DisposeAsync()
 {
 await _testHost.StopAsync();
 _testHost.Dispose();
 }
}

[BlobInput] injection

The WithBlobInputContent builder extension injects fake blob content for functions that use the [BlobInput] attribute (non-trigger input binding).

// Function under test
[Function("ReadDocument")]
public static string Run(
 [QueueTrigger("process-queue")] string blobPath,
 [BlobInput("documents/template.txt")] string templateContent)
{
 return $"Template: {templateContent}";
}
// Test setup
using AzureFunctions.TestFramework.Blob;

_testHost = await new FunctionsTestHostBuilder()
 .WithFunctionsAssembly(typeof(MyFunction).Assembly)
 // Register the content to inject for [BlobInput("documents/template.txt")]
 .WithBlobInputContent("documents/template.txt", BinaryData.FromString("Hello, template!"))
 .BuildAndStartAsync();

Multiple blobs: Use the dictionary overload to register several paths at once:

_testHost = await new FunctionsTestHostBuilder()
 .WithFunctionsAssembly(typeof(MyFunction).Assembly)
 .WithBlobInputContent(new Dictionary<string, BinaryData>
 {
 ["documents/template.txt"] = BinaryData.FromString("Hello, template!"),
 ["configs/settings.json"] = BinaryData.FromObjectAsJson(new { timeout = 30 }),
 })
 .BuildAndStartAsync();

The blobPath key must match the path declared in the [BlobInput] attribute exactly (case-insensitive). Dynamic path templates (e.g. "documents/{queueTrigger}") are matched against the template string, not the resolved path. When no content is registered for a binding, an empty byte[] is injected (which the worker surfaces as null / empty for string and stream parameters).

Supported parameter types: string, byte[], Stream, BinaryData, ReadOnlyMemory<byte>. For SDK client types (BlobClient, BlockBlobClient, etc.), see the sections below.

BlobTrigger with BlobClient parameter

When a blob-triggered function receives a BlobClient (or BlockBlobClient, PageBlobClient, etc.) instead of content bytes, register a BlobServiceClient on the test host and use the container/blob overload:

using Azure.Storage.Blobs;
using AzureFunctions.TestFramework.Blob;

_testHost = await new FunctionsTestHostBuilder()
 .WithFunctionsAssembly(typeof(MyBlobFunction).Assembly)
 .WithBlobServiceClient(new BlobServiceClient("UseDevelopmentStorage=true"))
 .BuildAndStartAsync();

// Invoke with container and blob name — the function receives a BlobClient
var result = await _testHost.InvokeBlobAsync("ProcessBlobClient", "my-container", "my-blob.txt");
Assert.True(result.Success);

[BlobInput] with BlobClient parameter

For [BlobInput] bindings targeting SDK client types, also register the blob path with WithBlobInputClient:

_testHost = await new FunctionsTestHostBuilder()
 .WithFunctionsAssembly(typeof(MyFunction).Assembly)
 .WithBlobServiceClient(new BlobServiceClient("UseDevelopmentStorage=true"))
 .WithBlobInputClient("my-container/data.txt")
 .BuildAndStartAsync();

Supported client parameter types: BlobClient, BlockBlobClient, PageBlobClient, AppendBlobClient, BlobBaseClient, BlobContainerClient.

References

License

MIT

Product Versions Compatible and additional computed target framework versions.
.NET net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 is compatible.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.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
0.14.0 98 5/25/2026
0.13.2 98 4/30/2026
0.12.0 98 4/20/2026
0.11.2 103 4/14/2026
0.11.1 120 4/13/2026
0.11.0 104 4/13/2026
0.10.0 103 4/11/2026
0.9.0 103 4/8/2026
0.8.0 108 4/7/2026
0.7.1 103 4/7/2026
0.7.0 110 4/7/2026
0.6.0 101 4/7/2026
0.5.0 109 4/2/2026
0.4.1 108 4/1/2026
0.4.0 108 4/1/2026
0.3.0 111 4/1/2026
0.2.1 112 3/17/2026
0.2.0 100 3/17/2026