You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🤖 This is a draft PR from Test Improver, an automated AI assistant focused on improving tests.
Goal and Rationale
Two internal helpers in Microsoft.Testing.Platform had no unit tests:
LoggingManager.BuildAsync – orchestrates provider lifecycle: non-extension providers are always included; extension providers are only included if IsEnabledAsync() returns true; TryInitializeAsync() is called only for included providers. Complex enough to warrant tests.
ExtensionValidationHelper.ValidateUniqueExtension – validates that no extension with the same UID is already registered, throwing InvalidOperationException with a detailed message. Both the generic (with selector) and the simple overload are tested.
Approach
Added 10 tests for LoggingManager.BuildAsync using Moq and combined interfaces (IExtensionLoggerProvider, IExtensionInitializableLoggerProvider, IInitializableLoggerProvider)
Added 15 tests for ExtensionValidationHelper.ValidateUniqueExtension covering both overloads
Updated TestExtension helper to accept an optional uid constructor parameter (defaults to "Uid" — no breaking changes)
The patch file is available in the agent artifact in the workflow run linked above.
To create a pull request with the changes:
# Download the artifact from the workflow run
gh run download 25615077058 -n agent -D /tmp/agent-25615077058
# Create a new branch
git checkout -b test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c
# Apply the patch (--3way handles cross-repo patches where files may already exist)
git am --3way /tmp/agent-25615077058/aw-test-assist-logging-manager-extension-validation-tests.patch
# Push the branch to origin
git push origin test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c
# Create the pull request
gh pr create --title '[Test Improver] test: add unit tests for LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension' --base main --head test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c --repo microsoft/testfx
Show patch preview (394 of 394 lines)
From 4e981b81f3f1063f1e8226e45e114a9db46b4896 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Sun, 10 May 2026 00:13:02 +0000
Subject: [PATCH] test: add unit tests for LoggingManager.BuildAsync and
ExtensionValidationHelper.ValidateUniqueExtension
Adds 25 new unit tests to Microsoft.Testing.Platform.UnitTests:
- 10 tests for LoggingManager.BuildAsync covering provider inclusion/exclusion,
initialization, log level/service provider propagation, and null validation
- 15 tests for ExtensionValidationHelper.ValidateUniqueExtension (both overloads)
covering null validation, duplicate detection, error message content, and
selector-based collection support
- Updates TestExtension helper to accept a configurable uid constructor parameter
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
.../Helpers/ExtensionValidationHelperTests.cs | 155 +++++++++++++++
.../Helpers/TestExtension.cs | 4 +-
.../Logging/LoggingManagerTests.cs | 185 ++++++++++++++++++
3 files changed, 343 insertions(+), 1 deletion(-)
create mode 100644 test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/ExtensionValidationHelperTests.cs
create mode 100644 test/UnitTests/Microsoft.Testing.Platform.UnitTests/Logging/LoggingManagerTests.cs
diff --git a/test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/ExtensionValidationHelperTests.cs b/test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/ExtensionValidationHelperTests.cs
new file mode 100644
index 0000000..1057f0b
--- /dev/null+++ b/test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/ExtensionValidationHelperTests.cs@@ -0,0 +1,155 @@+// Copyright (c) Microsoft Corporation. All rights reserved.+// Licensed under the MIT license. See LICENSE file in the project root for full license information.++using Microsoft.Testing.Platform.Extensions;+using Microsoft.Testing.Platform.Helpers;+using Microsoft.Te
... (truncated)
🤖 This is a draft PR from Test Improver, an automated AI assistant focused on improving tests.
Goal and Rationale
Two internal helpers in
Microsoft.Testing.Platformhad no unit tests:LoggingManager.BuildAsync– orchestrates provider lifecycle: non-extension providers are always included; extension providers are only included ifIsEnabledAsync()returnstrue;TryInitializeAsync()is called only for included providers. Complex enough to warrant tests.ExtensionValidationHelper.ValidateUniqueExtension– validates that no extension with the same UID is already registered, throwingInvalidOperationExceptionwith a detailed message. Both the generic (with selector) and the simple overload are tested.Approach
LoggingManager.BuildAsyncusing Moq and combined interfaces (IExtensionLoggerProvider,IExtensionInitializableLoggerProvider,IInitializableLoggerProvider)ExtensionValidationHelper.ValidateUniqueExtensioncovering both overloadsTestExtensionhelper to accept an optionaluidconstructor parameter (defaults to"Uid"— no breaking changes)Coverage Impact
Test Status
✅ Build:
dotnet build ... -p:TreatWarningsAsErrors=true→ 0 warnings, 0 errors✅ Tests:
dotnet test ... -f net8.0→ 674 passed, 2 skipped, 0 failedReproducibility
Note
This was originally intended as a pull request, but the git push operation failed.
Workflow Run: View run details and download patch artifact
The patch file is available in the
agentartifact in the workflow run linked above.To create a pull request with the changes:
Show patch preview (394 of 394 lines)