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
                    
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.11.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AzureFunctions.TestFramework.Blob" Version="0.11.2" />
                    
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.11.2
                    
#r "nuget: AzureFunctions.TestFramework.Blob, 0.11.2"
                    
#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.11.2
                    
#: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.11.2
                    
Install as a Cake Addin
#tool nuget:?package=AzureFunctions.TestFramework.Blob&version=0.11.2
                    
Install as a Cake Tool

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>. Complex types like BlobClient/BlockBlobClient use a different binding mechanism (model binding data) and are not supported by WithBlobInputContent. For those types, override the blob SDK client via ConfigureServices.

References

License

MIT

Product 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. 
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.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