AzureFunctions.TestFramework.Tables
0.12.0
dotnet add package AzureFunctions.TestFramework.Tables --version 0.12.0
NuGet\Install-Package AzureFunctions.TestFramework.Tables -Version 0.12.0
<PackageReference Include="AzureFunctions.TestFramework.Tables" Version="0.12.0" />
<PackageVersion Include="AzureFunctions.TestFramework.Tables" Version="0.12.0" />
<PackageReference Include="AzureFunctions.TestFramework.Tables" />
paket add AzureFunctions.TestFramework.Tables --version 0.12.0
#r "nuget: AzureFunctions.TestFramework.Tables, 0.12.0"
#:package AzureFunctions.TestFramework.Tables@0.12.0
#addin nuget:?package=AzureFunctions.TestFramework.Tables&version=0.12.0
#tool nuget:?package=AzureFunctions.TestFramework.Tables&version=0.12.0
AzureFunctions.TestFramework.Tables
Table input binding support for the Azure Functions Test Framework. Provides WithTableEntity(...) and WithTableEntities(...) — builder extensions that inject fake Azure Table Storage data for functions with [TableInput] parameters in integration tests. Output binding values ([TableOutput]) are captured generically by Core's FunctionInvocationResult without any per-extension work.
[TableInput] injection
// Function under test
[Function("LookupOrder")]
public static string Run(
[QueueTrigger("lookup-queue")] string rowKey,
[TableInput("Orders", "customer-1", "{queueTrigger}")] OrderEntity order)
{
return $"Order: {order.Status}";
}
using AzureFunctions.TestFramework.Core;
using AzureFunctions.TestFramework.Tables;
// Single entity — matches [TableInput("Orders", "customer-1", "order-42")]
_testHost = await new FunctionsTestHostBuilder()
.WithFunctionsAssembly(typeof(MyFunction).Assembly)
.WithTableEntity("Orders", "customer-1", "order-42",
new OrderEntity { PartitionKey = "customer-1", RowKey = "order-42", Status = "Pending" })
.BuildAndStartAsync();
// Collection — matches [TableInput("Orders")] (no partitionKey / rowKey)
_testHost = await new FunctionsTestHostBuilder()
.WithFunctionsAssembly(typeof(MyFunction).Assembly)
.WithTableEntities("Orders",
new[]
{
new OrderEntity { PartitionKey = "customer-1", RowKey = "order-1", Status = "Pending" },
new OrderEntity { PartitionKey = "customer-1", RowKey = "order-2", Status = "Shipped" },
})
.BuildAndStartAsync();
// Partition-scoped collection — matches [TableInput("Orders", "customer-1")]
_testHost = await new FunctionsTestHostBuilder()
.WithFunctionsAssembly(typeof(MyFunction).Assembly)
.WithTableEntities("Orders", "customer-1",
new[]
{
new OrderEntity { PartitionKey = "customer-1", RowKey = "order-1", Status = "Pending" },
})
.BuildAndStartAsync();
Lookup is performed from most-specific to least-specific key:
tableName/partitionKey/rowKey— single entity (matches[TableInput("T", "pk", "rk")])tableName/partitionKey— partition-scoped collection (matches[TableInput("T", "pk")])tableName— full-table collection (matches[TableInput("T")])
Supported parameter types for
[TableInput]: POCO types,TableEntity/ITableEntity,IEnumerable<T>.TableClientuses a different model-binding-data mechanism and is not supported byWithTableEntity/WithTableEntities. ForTableClientparameters, override the Azure Tables SDK client in DI viaConfigureServices.
[TableOutput] capture
Output binding values are captured generically by Core's FunctionInvocationResult.OutputData without any extra configuration:
var result = await _testHost.InvokeQueueAsync("WriteOrder", message);
var entity = result.ReadOutputAs<OrderEntity>("Entity"); // binding name from [TableOutput]
Assert.Equal("customer-1", entity.PartitionKey);
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.12.0)
- Microsoft.Azure.Functions.Worker.Extensions.Tables (>= 1.5.0)
-
net8.0
- AzureFunctions.TestFramework.Core (>= 0.12.0)
- Microsoft.Azure.Functions.Worker.Extensions.Tables (>= 1.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.