Skip to content

v6.1.0: Functions webhook clients and shared testing fixtures - #108

Merged
chullybun merged 1 commit into
mainfrom
v6.1.0
Nov 5, 2026
Merged

chullybun merged 1 commit into
mainfrom
v6.1.0

Conversation

@chullybun

Copy link
Copy Markdown
Collaborator

Summary

  • Add public FunctionsWebhookClient(HttpClient) so runners can reuse webhook serialization and notification headers without launching an Aspire fixture. The caller retains ownership of the supplied client and returned responses; Aspire-created clients retain their existing per-request disposal behavior.
  • Add framework-neutral WithFunctionTester<TEntryPoint> with fixture-level disposal and optional test-framework factories on the fixture, FunctionTester.Create, and concrete tester constructor.
  • Update usage documentation and changelog, bump the shared package version to 6.1.0, and include the build-output cleanup script.

Validation

  • Targeted WithFunctionTesterTest NUnit tests: 9 passed on each of .NET 8, 9, and 10.
  • Targeted WithFunctionTesterTest xUnit tests: 2 passed on each of .NET 8, 9, and 10.
  • Standalone FunctionsWebhookClientTest tests: 6 passed on each of .NET 8, 9, and 10, covering request payloads/headers, repeated calls, ownership, failure, cancellation, and null arguments.
  • PowerShell cleanup script parses successfully; it was not executed.
  • git diff --check passes. Existing ASPIRE010 CLI-bundle configuration warnings remain.

Add caller-owned HttpClient support for Functions webhooks, shared Functions fixtures and framework factories, updated documentation, and build-output cleanup tooling.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 5, 2026 23:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Public API signature changes can break previously compiled consumers, and unchecked configuration paths allow the cleanup script to recursively delete project source files.

3 open issues
What changed in this PR

This PR extends Azure Functions testing with standalone webhook clients and framework-neutral fixtures, packaged as version 6.1.0.

Changes:

  • Adds webhook support using a caller-owned HttpClient, without launching Aspire.
  • Adds WithFunctionTester<TEntryPoint> and optional test-framework factories, with lifecycle and ownership tests.
  • Updates documentation and release metadata, and adds a build-output cleanup script.
File Description
tests/​UnitTestEx.Xunit.Test/​WithFunctionTesterTest.cs Tests explicit xUnit factories, assertions, and output capture.
tests/​UnitTestEx.NUnit.Test/​WithFunctionTesterTest.cs Tests tester reuse, configuration, factory failures, and disposal.
tests/​UnitTestEx.Aspire.NUnit.Test/​FunctionsWebhookClientTest.cs Tests webhook payloads, headers, ownership, and failure handling.
src/​UnitTestEx.Azure.Functions/​WithFunctionTester.cs Adds the shared, disposable Functions fixture base.
src/​UnitTestEx.Azure.Functions/​FunctionTester.cs Adds an optional framework factory to tester creation.
src/​UnitTestEx.Azure.Functions/​Azure/​Functions/​FunctionTesterT.cs Adds constructor factory support and corrects the summary comment.
src/​UnitTestEx.Aspire/​Aspire/​FunctionsWebhookClient.cs Supports caller-owned HTTP clients while preserving Aspire client disposal.
docs/​azure-functions.md Documents fixture lifetimes, disposal, and framework factories.
docs/​aspire.md Documents standalone webhook usage and client ownership.
Common.targets Sets the shared package version to 6.1.0.
clean-build-outputs.ps1 Adds configurable cleanup with preview and build-server shutdown options.
CHANGELOG.md Records the new 6.1.0 testing features.

Review effort: Balanced

Comment thread clean-build-outputs.ps1
Comment on lines +51 to +52
$path = Join-Path $_.FullName $config
if (Test-Path -LiteralPath $path) { Get-Item -LiteralPath $path }
/// <param name="createFactory">The optional function to create the <see cref="TestFrameworkImplementor"/> instance.</param>
public class FunctionTester<TEntryPoint>(bool? includeUnitTestConfiguration, bool? includeUserSecrets, IEnumerable<KeyValuePair<string, string?>>? additionalConfiguration, Func<TestFrameworkImplementor>? createFactory = null)
: FunctionTesterBase<TEntryPoint, FunctionTester<TEntryPoint>>(TestFrameworkImplementor.Create(createFactory), includeUnitTestConfiguration, includeUserSecrets, additionalConfiguration) where TEntryPoint : class
{ }
/// <param name="createFactory">The optional function to create the <see cref="TestFrameworkImplementor"/> instance.</param>
/// <returns>The <see cref="FunctionTester{TEntryPoint}"/>.</returns>
public static FunctionTester<TEntryPoint> Create<TEntryPoint>(bool? includeUnitTestConfiguration = null, bool? includeUserSecrets = null, IEnumerable<KeyValuePair<string, string?>>? additionalConfiguration = null)
public static FunctionTester<TEntryPoint> Create<TEntryPoint>(bool? includeUnitTestConfiguration = null, bool? includeUserSecrets = null, IEnumerable<KeyValuePair<string, string?>>? additionalConfiguration = null, Func<TestFrameworkImplementor>? createFactory = null)
@chullybun
chullybun merged commit 0cc44fb into main Nov 5, 2026
3 of 5 checks passed
@chullybun
chullybun deleted the v6.1.0 branch November 5, 2026 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants