Skip to content

[Test Improver] test: improve LoggingManagerTests quality #8167

@Evangelink

Description

@Evangelink

🤖 Test Improver — an automated AI assistant focused on improving tests.

Goal

Apply two quality improvements to LoggingManagerTests.cs that were explicitly requested by Evangelink in the review on #8129. This is a clean PR that touches only the test file.

Closes #8140

Changes

Only test/UnitTests/Microsoft.Testing.Platform.UnitTests/Logging/LoggingManagerTests.cs is modified.

1. Explicit discard for factory.CreateLogger() calls

All factory.CreateLogger(...) calls changed to _ = factory.CreateLogger(...).

Why: These calls are made purely for their side-effect (triggering the mock). Using _ = signals clearly that the discard is intentional, matching the pattern in sibling file LoggerFactoryTests.cs.

2. New test: BuildAsync_MultipleProviders_OnlyIncludesEnabledOnes

Registers a disabled IExtension provider and an enabled plain ILoggerProvider simultaneously, then verifies:

  • The disabled extension provider's CreateLogger is never called
  • The enabled provider's CreateLogger is called exactly once

Why: Covers the foreach ... continue loop in LoggingManager.BuildAsync. A bug that inadvertently skips the next provider after a disabled one would previously have gone undetected.

Test Status

✅ All 22 tests pass (net8.0 + net9.0, 11 existing × 2 TFMs + 1 new × 2 TFMs)

Coverage Impact

Count
Before 11 test methods
After 12 test methods

Generated by Daily Test Improver · ● 10.3M ·


Note

This was originally intended as a pull request, but the git push operation failed.

Workflow Run: View run details and download bundle artifact

The bundle 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 25783202174 -n agent -D /tmp/agent-25783202174

# Fetch the bundle into a local branch
git fetch /tmp/agent-25783202174/aw-test-assist-logging-manager-quality-improvements-2026-05-13.bundle refs/heads/test-assist/logging-manager-quality-improvements-2026-05-13:refs/heads/test-assist/logging-manager-quality-improvements-2026-05-13-e0eb44af6c564a7e
git checkout test-assist/logging-manager-quality-improvements-2026-05-13-e0eb44af6c564a7e

# Push the branch to origin
git push origin test-assist/logging-manager-quality-improvements-2026-05-13-e0eb44af6c564a7e

# Create the pull request
gh pr create --title '[Test Improver] test: improve LoggingManagerTests quality' --base main --head test-assist/logging-manager-quality-improvements-2026-05-13-e0eb44af6c564a7e --repo microsoft/testfx

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/agentic-workflowsGitHub agentic workflow definitions under .github/workflows/*.md.type/automationCreated or maintained by an agentic workflow.type/test-gapMissing or insufficient tests.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions