AzureFunctions.TestFramework.Blob
0.11.2
dotnet add package AzureFunctions.TestFramework.Blob --version 0.11.2
NuGet\Install-Package AzureFunctions.TestFramework.Blob -Version 0.11.2
<PackageReference Include="AzureFunctions.TestFramework.Blob" Version="0.11.2" />
<PackageVersion Include="AzureFunctions.TestFramework.Blob" Version="0.11.2" />
<PackageReference Include="AzureFunctions.TestFramework.Blob" />
paket add AzureFunctions.TestFramework.Blob --version 0.11.2
#r "nuget: AzureFunctions.TestFramework.Blob, 0.11.2"
#:package AzureFunctions.TestFramework.Blob@0.11.2
#addin nuget:?package=AzureFunctions.TestFramework.Blob&version=0.11.2
#tool nuget:?package=AzureFunctions.TestFramework.Blob&version=0.11.2
AzureFunctions.TestFramework.Blob
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>. Complex types likeBlobClient/BlockBlobClientuse a different binding mechanism (model binding data) and are not supported byWithBlobInputContent. For those types, override the blob SDK client viaConfigureServices.
References
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- AzureFunctions.TestFramework.Core (>= 0.11.2)
- Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs (>= 6.8.1)
-
net8.0
- AzureFunctions.TestFramework.Core (>= 0.11.2)
- Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs (>= 6.8.1)
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.11.2 | 79 | 4/14/2026 |
| 0.11.1 | 101 | 4/13/2026 |
| 0.11.0 | 85 | 4/13/2026 |
| 0.10.0 | 87 | 4/11/2026 |
| 0.9.0 | 84 | 4/8/2026 |
| 0.8.0 | 91 | 4/7/2026 |
| 0.7.1 | 86 | 4/7/2026 |
| 0.7.0 | 90 | 4/7/2026 |
| 0.6.0 | 82 | 4/7/2026 |
| 0.5.0 | 90 | 4/2/2026 |
| 0.4.1 | 91 | 4/1/2026 |
| 0.4.0 | 85 | 4/1/2026 |
| 0.3.0 | 91 | 4/1/2026 |
| 0.2.1 | 91 | 3/17/2026 |
| 0.2.0 | 83 | 3/17/2026 |