[Test Improver] test: add unit tests for LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension - #8125

Merged
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c
May 13, 2026
Merged

[Test Improver] test: add unit tests for LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension#8125
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c

Conversation

@Evangelink

@EvangelinkAmaury Levé (Evangelink) commented May 11, 2026

Copy link
Copy Markdown
Member

Adds focused unit test coverage in Microsoft.Testing.Platform.UnitTests for:

  • LoggingManager.BuildAsync (provider inclusion/exclusion, initialization behavior, and factory argument propagation)
  • ExtensionValidationHelper.ValidateUniqueExtension (null guards, duplicate UID detection, and error message assertions)

Also includes follow-up review feedback fixes:

  • Renamed the duplicate-UID type-name test to match what it asserts.
  • Standardized logger category literals in LoggingManagerTests.
  • Scoped test-only helper interfaces inside LoggingManagerTests.
  • Added explicit InitializeAsync setup in the disabled-provider test to keep regression failures actionable.

Finally, this PR branch was merged with main and merge conflicts were resolved in the two new test files without changing the intended test coverage scope.

…ationHelper.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>
CopilotAI review requested due to automatic review settings May 11, 2026 14:41

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: PR Nitpick Reviewer 🔍
Date: 2026-05-11
Repository: microsoft/testfx

Key Findings

Important

  • ValidateUniqueExtension_WithDuplicateUid_ErrorMessageContainsBothTypeNames asserts only one type name: both existing[0] and newExtension are the same type (TestExtension), so the test name is misleading.

Minor

  • Inconsistent logger category names across tests: "test", "category", and "cat" are used for the same conceptual placeholder.
  • Three internal interface helpers are declared at file scope; nesting them inside LoggingManagerTests would better scope them.

Positive Highlights

  • Clean Arrange/Act/Assert structure throughout both test files.
  • Good coverage of null parameters, enabled/disabled providers, and initializable variants.
  • The modification to TestExtension to accept a configurable uid via constructor is a well-thought-out change to enable richer test scenarios.

Generated by PR Nitpick Reviewer

🔍 Meticulously inspected by PR Nitpick Reviewer 🔍

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

Pull request overview

Adds missing unit test coverage in Microsoft.Testing.Platform.UnitTests for two internal helpers in Microsoft.Testing.Platform: LoggingManager.BuildAsync (provider inclusion/initialization behavior) and ExtensionValidationHelper.ValidateUniqueExtension (duplicate UID detection and message content), plus a small enhancement to the TestExtension test helper to allow configurable UIDs.

Changes:

  • Add LoggingManagerTests covering enabled/disabled extension providers, initialization behavior, and factory argument propagation.
  • Add ExtensionValidationHelperTests covering null validation, duplicate detection for both overloads, selector-based collections, and error message content.
  • Update TestExtension helper to accept an optional uid constructor parameter for easier test setup.
Show a summary per file
FileDescription
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Logging/LoggingManagerTests.csNew tests validating LoggingManager.BuildAsync provider filtering, initialization, and propagation of log level/service provider.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/TestExtension.csEnhances the test helper to support configurable Uid values.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/ExtensionValidationHelperTests.csNew tests validating ValidateUniqueExtension duplicate detection (both overloads) and error message contents.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: Expert Code Reviewer
Date: 2026-05-11
Repository: microsoft/testfx

Review

PR #8125 adds 25 unit tests for two internal components:

  • LoggingManager.BuildAsync (10 tests): Covers provider inclusion/exclusion based on IExtension.IsEnabledAsync(), initialization ordering via IAsyncInitializableExtension.TryInitializeAsync(), log level and service provider propagation, and null argument validation.
  • ExtensionValidationHelper.ValidateUniqueExtension (15 tests): Covers both overloads (direct and selector-based), null argument guards, empty collections, non-duplicate pass-through, duplicate detection, and error message content.

Key Findings

No issues found in any of the review categories.

Verified correct:

  • All async test assertions properly awaitBuildAsync, which chains through IsEnabledAsync() and TryInitializeAsync() correctly.
  • Assert.Contains(substring, value) parameter order is correct per MSTest's string overload signature (substring first, container second).
  • LoggerFactory.CreateLogger caches per category — Times.Once verifications are accurate.
  • IExtensionLoggerProvider, IExtensionInitializableLoggerProvider, and IInitializableLoggerProvider test-internal interface declarations are unique in the namespace and correctly compose IExtension + IAsyncInitializableExtension to trigger the right branches in BuildAsync.
  • TestExtension.cs refactor (constructor-based Uid with default "Uid") is backward-compatible with all existing usages.
  • Mock<IMonitor> setup in the test constructor returns a valid IDisposable for LoggerFactory's using (_monitor.Lock(...)) pattern.
  • Moq 4.18.4 default behavior for Task-returning methods returns Task.CompletedTask — explicit setups are correct (and redundant ones are harmless).

Recommendations

None — the tests are well-structured and correctly exercise the production code paths.


Generated by Expert Code Reviewer

🧠 Reviewed by Expert Code Reviewer 🧠

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: Test Expert Reviewer 🧪
Date: 2026-05-11
Repository: microsoft/testfx

Key Findings

  1. [Assertion]ValidateUniqueExtension_WithDuplicateUid_ErrorMessageContainsBothTypeNames — the test name promises verification of two distinct type names in the error message, but both extensions are TestExtension and only one Assert.Contains is made. This is misleading: if the production code omitted one type name, the test would still pass.

  2. [Coverage]LoggingManagerTests covers null validation for AddProvider but not for BuildAsync itself. If BuildAsync guards its serviceProvider or monitor parameters against null, those guards have no test coverage.

Recommendations

  • For finding 1: either rename the test to ...ErrorMessageContainsTypeName or introduce two different concrete IExtension types with two separate Assert.Contains calls.
  • For finding 2: add BuildAsync_WithNullServiceProvider_ThrowsArgumentNullException and BuildAsync_WithNullMonitor_ThrowsArgumentNullException if those null guards exist in the production code.

Overall the tests are well-structured, properly isolated (MSTest new-instance-per-test, no shared mutable state), use the correct assertion APIs for this project, and cover the key happy/sad paths for both LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension.


Generated by Test Expert Reviewer

🧪 Test quality reviewed by Test Expert Reviewer 🧪

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Copilot address review comments

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
CopilotAI review requested due to automatic review settings May 11, 2026 15:45
@Evangelink
Amaury Levé (Evangelink) removed the request for review from CopilotMay 11, 2026 15:45

CopilotAI commented May 11, 2026

Copy link
Copy Markdown
Contributor

Copilot address review comments

Done in f8180d9. I addressed the remaining review comment on LoggingManagerTests by explicitly setting up InitializeAsync on the disabled-provider mock and validated with targeted tests.

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Copilot resolve the merge conflicts in this pull request

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
CopilotAI review requested due to automatic review settings May 11, 2026 16:40
@Evangelink
Amaury Levé (Evangelink) removed the request for review from CopilotMay 11, 2026 16:40

CopilotAI commented May 11, 2026

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

Resolved in d64e3c6: merged origin/main into this branch and resolved the conflicts in the two test files.

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Note

The pull request was not created — a fallback review issue was created instead due to protected file changes: #8140

🤖 Test Improver here. Status update: the work in this PR has been superseded. The LoggingManager tests landed in main via #8124 and #8130, and the ExtensionValidationHelper tests landed via #8128.

This PR is a duplicate of merged work — it can be safely closed.

Generated by Daily Test Improver · ● 9.5M ·

…anager-extension-validation-tests-853aaedb3e22557c
@Evangelink
Amaury Levé (Evangelink) merged commit 455986a into mainMay 13, 2026
10 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c branch May 13, 2026 12:58
Sign up for freeto 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.

3 participants

@Evangelink
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

[Test Improver] test: add unit tests for LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension - #8125

Merged
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c
May 13, 2026
Merged

[Test Improver] test: add unit tests for LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension#8125
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c

Conversation

@Evangelink

@EvangelinkAmaury Levé (Evangelink) commented May 11, 2026

Copy link
Copy Markdown
Member

Adds focused unit test coverage in Microsoft.Testing.Platform.UnitTests for:

  • LoggingManager.BuildAsync (provider inclusion/exclusion, initialization behavior, and factory argument propagation)
  • ExtensionValidationHelper.ValidateUniqueExtension (null guards, duplicate UID detection, and error message assertions)

Also includes follow-up review feedback fixes:

  • Renamed the duplicate-UID type-name test to match what it asserts.
  • Standardized logger category literals in LoggingManagerTests.
  • Scoped test-only helper interfaces inside LoggingManagerTests.
  • Added explicit InitializeAsync setup in the disabled-provider test to keep regression failures actionable.

Finally, this PR branch was merged with main and merge conflicts were resolved in the two new test files without changing the intended test coverage scope.

…ationHelper.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>
CopilotAI review requested due to automatic review settings May 11, 2026 14:41

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: PR Nitpick Reviewer 🔍
Date: 2026-05-11
Repository: microsoft/testfx

Key Findings

Important

  • ValidateUniqueExtension_WithDuplicateUid_ErrorMessageContainsBothTypeNames asserts only one type name: both existing[0] and newExtension are the same type (TestExtension), so the test name is misleading.

Minor

  • Inconsistent logger category names across tests: "test", "category", and "cat" are used for the same conceptual placeholder.
  • Three internal interface helpers are declared at file scope; nesting them inside LoggingManagerTests would better scope them.

Positive Highlights

  • Clean Arrange/Act/Assert structure throughout both test files.
  • Good coverage of null parameters, enabled/disabled providers, and initializable variants.
  • The modification to TestExtension to accept a configurable uid via constructor is a well-thought-out change to enable richer test scenarios.

Generated by PR Nitpick Reviewer

🔍 Meticulously inspected by PR Nitpick Reviewer 🔍

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

Pull request overview

Adds missing unit test coverage in Microsoft.Testing.Platform.UnitTests for two internal helpers in Microsoft.Testing.Platform: LoggingManager.BuildAsync (provider inclusion/initialization behavior) and ExtensionValidationHelper.ValidateUniqueExtension (duplicate UID detection and message content), plus a small enhancement to the TestExtension test helper to allow configurable UIDs.

Changes:

  • Add LoggingManagerTests covering enabled/disabled extension providers, initialization behavior, and factory argument propagation.
  • Add ExtensionValidationHelperTests covering null validation, duplicate detection for both overloads, selector-based collections, and error message content.
  • Update TestExtension helper to accept an optional uid constructor parameter for easier test setup.
Show a summary per file
FileDescription
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Logging/LoggingManagerTests.csNew tests validating LoggingManager.BuildAsync provider filtering, initialization, and propagation of log level/service provider.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/TestExtension.csEnhances the test helper to support configurable Uid values.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/ExtensionValidationHelperTests.csNew tests validating ValidateUniqueExtension duplicate detection (both overloads) and error message contents.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: Expert Code Reviewer
Date: 2026-05-11
Repository: microsoft/testfx

Review

PR #8125 adds 25 unit tests for two internal components:

  • LoggingManager.BuildAsync (10 tests): Covers provider inclusion/exclusion based on IExtension.IsEnabledAsync(), initialization ordering via IAsyncInitializableExtension.TryInitializeAsync(), log level and service provider propagation, and null argument validation.
  • ExtensionValidationHelper.ValidateUniqueExtension (15 tests): Covers both overloads (direct and selector-based), null argument guards, empty collections, non-duplicate pass-through, duplicate detection, and error message content.

Key Findings

No issues found in any of the review categories.

Verified correct:

  • All async test assertions properly awaitBuildAsync, which chains through IsEnabledAsync() and TryInitializeAsync() correctly.
  • Assert.Contains(substring, value) parameter order is correct per MSTest's string overload signature (substring first, container second).
  • LoggerFactory.CreateLogger caches per category — Times.Once verifications are accurate.
  • IExtensionLoggerProvider, IExtensionInitializableLoggerProvider, and IInitializableLoggerProvider test-internal interface declarations are unique in the namespace and correctly compose IExtension + IAsyncInitializableExtension to trigger the right branches in BuildAsync.
  • TestExtension.cs refactor (constructor-based Uid with default "Uid") is backward-compatible with all existing usages.
  • Mock<IMonitor> setup in the test constructor returns a valid IDisposable for LoggerFactory's using (_monitor.Lock(...)) pattern.
  • Moq 4.18.4 default behavior for Task-returning methods returns Task.CompletedTask — explicit setups are correct (and redundant ones are harmless).

Recommendations

None — the tests are well-structured and correctly exercise the production code paths.


Generated by Expert Code Reviewer

🧠 Reviewed by Expert Code Reviewer 🧠

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: Test Expert Reviewer 🧪
Date: 2026-05-11
Repository: microsoft/testfx

Key Findings

  1. [Assertion]ValidateUniqueExtension_WithDuplicateUid_ErrorMessageContainsBothTypeNames — the test name promises verification of two distinct type names in the error message, but both extensions are TestExtension and only one Assert.Contains is made. This is misleading: if the production code omitted one type name, the test would still pass.

  2. [Coverage]LoggingManagerTests covers null validation for AddProvider but not for BuildAsync itself. If BuildAsync guards its serviceProvider or monitor parameters against null, those guards have no test coverage.

Recommendations

  • For finding 1: either rename the test to ...ErrorMessageContainsTypeName or introduce two different concrete IExtension types with two separate Assert.Contains calls.
  • For finding 2: add BuildAsync_WithNullServiceProvider_ThrowsArgumentNullException and BuildAsync_WithNullMonitor_ThrowsArgumentNullException if those null guards exist in the production code.

Overall the tests are well-structured, properly isolated (MSTest new-instance-per-test, no shared mutable state), use the correct assertion APIs for this project, and cover the key happy/sad paths for both LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension.


Generated by Test Expert Reviewer

🧪 Test quality reviewed by Test Expert Reviewer 🧪

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Copilot address review comments

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
CopilotAI review requested due to automatic review settings May 11, 2026 15:45
@Evangelink
Amaury Levé (Evangelink) removed the request for review from CopilotMay 11, 2026 15:45

CopilotAI commented May 11, 2026

Copy link
Copy Markdown
Contributor

Copilot address review comments

Done in f8180d9. I addressed the remaining review comment on LoggingManagerTests by explicitly setting up InitializeAsync on the disabled-provider mock and validated with targeted tests.

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Copilot resolve the merge conflicts in this pull request

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
CopilotAI review requested due to automatic review settings May 11, 2026 16:40
@Evangelink
Amaury Levé (Evangelink) removed the request for review from CopilotMay 11, 2026 16:40

CopilotAI commented May 11, 2026

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

Resolved in d64e3c6: merged origin/main into this branch and resolved the conflicts in the two test files.

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Note

The pull request was not created — a fallback review issue was created instead due to protected file changes: #8140

🤖 Test Improver here. Status update: the work in this PR has been superseded. The LoggingManager tests landed in main via #8124 and #8130, and the ExtensionValidationHelper tests landed via #8128.

This PR is a duplicate of merged work — it can be safely closed.

Generated by Daily Test Improver · ● 9.5M ·

…anager-extension-validation-tests-853aaedb3e22557c
@Evangelink
Amaury Levé (Evangelink) merged commit 455986a into mainMay 13, 2026
10 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c branch May 13, 2026 12:58
Sign up for freeto 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.

3 participants

@Evangelink
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[Test Improver] test: add unit tests for LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension - #8125

Merged
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c
May 13, 2026
Merged

[Test Improver] test: add unit tests for LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension#8125
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c

Conversation

@Evangelink

@EvangelinkAmaury Levé (Evangelink) commented May 11, 2026

Copy link
Copy Markdown
Member

Adds focused unit test coverage in Microsoft.Testing.Platform.UnitTests for:

  • LoggingManager.BuildAsync (provider inclusion/exclusion, initialization behavior, and factory argument propagation)
  • ExtensionValidationHelper.ValidateUniqueExtension (null guards, duplicate UID detection, and error message assertions)

Also includes follow-up review feedback fixes:

  • Renamed the duplicate-UID type-name test to match what it asserts.
  • Standardized logger category literals in LoggingManagerTests.
  • Scoped test-only helper interfaces inside LoggingManagerTests.
  • Added explicit InitializeAsync setup in the disabled-provider test to keep regression failures actionable.

Finally, this PR branch was merged with main and merge conflicts were resolved in the two new test files without changing the intended test coverage scope.

…ationHelper.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>
CopilotAI review requested due to automatic review settings May 11, 2026 14:41

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: PR Nitpick Reviewer 🔍
Date: 2026-05-11
Repository: microsoft/testfx

Key Findings

Important

  • ValidateUniqueExtension_WithDuplicateUid_ErrorMessageContainsBothTypeNames asserts only one type name: both existing[0] and newExtension are the same type (TestExtension), so the test name is misleading.

Minor

  • Inconsistent logger category names across tests: "test", "category", and "cat" are used for the same conceptual placeholder.
  • Three internal interface helpers are declared at file scope; nesting them inside LoggingManagerTests would better scope them.

Positive Highlights

  • Clean Arrange/Act/Assert structure throughout both test files.
  • Good coverage of null parameters, enabled/disabled providers, and initializable variants.
  • The modification to TestExtension to accept a configurable uid via constructor is a well-thought-out change to enable richer test scenarios.

Generated by PR Nitpick Reviewer

🔍 Meticulously inspected by PR Nitpick Reviewer 🔍

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

Pull request overview

Adds missing unit test coverage in Microsoft.Testing.Platform.UnitTests for two internal helpers in Microsoft.Testing.Platform: LoggingManager.BuildAsync (provider inclusion/initialization behavior) and ExtensionValidationHelper.ValidateUniqueExtension (duplicate UID detection and message content), plus a small enhancement to the TestExtension test helper to allow configurable UIDs.

Changes:

  • Add LoggingManagerTests covering enabled/disabled extension providers, initialization behavior, and factory argument propagation.
  • Add ExtensionValidationHelperTests covering null validation, duplicate detection for both overloads, selector-based collections, and error message content.
  • Update TestExtension helper to accept an optional uid constructor parameter for easier test setup.
Show a summary per file
FileDescription
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Logging/LoggingManagerTests.csNew tests validating LoggingManager.BuildAsync provider filtering, initialization, and propagation of log level/service provider.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/TestExtension.csEnhances the test helper to support configurable Uid values.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/ExtensionValidationHelperTests.csNew tests validating ValidateUniqueExtension duplicate detection (both overloads) and error message contents.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: Expert Code Reviewer
Date: 2026-05-11
Repository: microsoft/testfx

Review

PR #8125 adds 25 unit tests for two internal components:

  • LoggingManager.BuildAsync (10 tests): Covers provider inclusion/exclusion based on IExtension.IsEnabledAsync(), initialization ordering via IAsyncInitializableExtension.TryInitializeAsync(), log level and service provider propagation, and null argument validation.
  • ExtensionValidationHelper.ValidateUniqueExtension (15 tests): Covers both overloads (direct and selector-based), null argument guards, empty collections, non-duplicate pass-through, duplicate detection, and error message content.

Key Findings

No issues found in any of the review categories.

Verified correct:

  • All async test assertions properly awaitBuildAsync, which chains through IsEnabledAsync() and TryInitializeAsync() correctly.
  • Assert.Contains(substring, value) parameter order is correct per MSTest's string overload signature (substring first, container second).
  • LoggerFactory.CreateLogger caches per category — Times.Once verifications are accurate.
  • IExtensionLoggerProvider, IExtensionInitializableLoggerProvider, and IInitializableLoggerProvider test-internal interface declarations are unique in the namespace and correctly compose IExtension + IAsyncInitializableExtension to trigger the right branches in BuildAsync.
  • TestExtension.cs refactor (constructor-based Uid with default "Uid") is backward-compatible with all existing usages.
  • Mock<IMonitor> setup in the test constructor returns a valid IDisposable for LoggerFactory's using (_monitor.Lock(...)) pattern.
  • Moq 4.18.4 default behavior for Task-returning methods returns Task.CompletedTask — explicit setups are correct (and redundant ones are harmless).

Recommendations

None — the tests are well-structured and correctly exercise the production code paths.


Generated by Expert Code Reviewer

🧠 Reviewed by Expert Code Reviewer 🧠

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: Test Expert Reviewer 🧪
Date: 2026-05-11
Repository: microsoft/testfx

Key Findings

  1. [Assertion]ValidateUniqueExtension_WithDuplicateUid_ErrorMessageContainsBothTypeNames — the test name promises verification of two distinct type names in the error message, but both extensions are TestExtension and only one Assert.Contains is made. This is misleading: if the production code omitted one type name, the test would still pass.

  2. [Coverage]LoggingManagerTests covers null validation for AddProvider but not for BuildAsync itself. If BuildAsync guards its serviceProvider or monitor parameters against null, those guards have no test coverage.

Recommendations

  • For finding 1: either rename the test to ...ErrorMessageContainsTypeName or introduce two different concrete IExtension types with two separate Assert.Contains calls.
  • For finding 2: add BuildAsync_WithNullServiceProvider_ThrowsArgumentNullException and BuildAsync_WithNullMonitor_ThrowsArgumentNullException if those null guards exist in the production code.

Overall the tests are well-structured, properly isolated (MSTest new-instance-per-test, no shared mutable state), use the correct assertion APIs for this project, and cover the key happy/sad paths for both LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension.


Generated by Test Expert Reviewer

🧪 Test quality reviewed by Test Expert Reviewer 🧪

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Copilot address review comments

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
CopilotAI review requested due to automatic review settings May 11, 2026 15:45
@Evangelink
Amaury Levé (Evangelink) removed the request for review from CopilotMay 11, 2026 15:45

CopilotAI commented May 11, 2026

Copy link
Copy Markdown
Contributor

Copilot address review comments

Done in f8180d9. I addressed the remaining review comment on LoggingManagerTests by explicitly setting up InitializeAsync on the disabled-provider mock and validated with targeted tests.

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Copilot resolve the merge conflicts in this pull request

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
CopilotAI review requested due to automatic review settings May 11, 2026 16:40
@Evangelink
Amaury Levé (Evangelink) removed the request for review from CopilotMay 11, 2026 16:40

CopilotAI commented May 11, 2026

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

Resolved in d64e3c6: merged origin/main into this branch and resolved the conflicts in the two test files.

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Note

The pull request was not created — a fallback review issue was created instead due to protected file changes: #8140

🤖 Test Improver here. Status update: the work in this PR has been superseded. The LoggingManager tests landed in main via #8124 and #8130, and the ExtensionValidationHelper tests landed via #8128.

This PR is a duplicate of merged work — it can be safely closed.

Generated by Daily Test Improver · ● 9.5M ·

…anager-extension-validation-tests-853aaedb3e22557c
@Evangelink
Amaury Levé (Evangelink) merged commit 455986a into mainMay 13, 2026
10 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c branch May 13, 2026 12:58
Sign up for freeto 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.

3 participants

@Evangelink
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[Test Improver] test: add unit tests for LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension - #8125

Merged
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c
May 13, 2026
Merged

[Test Improver] test: add unit tests for LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension#8125
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c

Conversation

@Evangelink

@EvangelinkAmaury Levé (Evangelink) commented May 11, 2026

Copy link
Copy Markdown
Member

Adds focused unit test coverage in Microsoft.Testing.Platform.UnitTests for:

  • LoggingManager.BuildAsync (provider inclusion/exclusion, initialization behavior, and factory argument propagation)
  • ExtensionValidationHelper.ValidateUniqueExtension (null guards, duplicate UID detection, and error message assertions)

Also includes follow-up review feedback fixes:

  • Renamed the duplicate-UID type-name test to match what it asserts.
  • Standardized logger category literals in LoggingManagerTests.
  • Scoped test-only helper interfaces inside LoggingManagerTests.
  • Added explicit InitializeAsync setup in the disabled-provider test to keep regression failures actionable.

Finally, this PR branch was merged with main and merge conflicts were resolved in the two new test files without changing the intended test coverage scope.

…ationHelper.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>
CopilotAI review requested due to automatic review settings May 11, 2026 14:41

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: PR Nitpick Reviewer 🔍
Date: 2026-05-11
Repository: microsoft/testfx

Key Findings

Important

  • ValidateUniqueExtension_WithDuplicateUid_ErrorMessageContainsBothTypeNames asserts only one type name: both existing[0] and newExtension are the same type (TestExtension), so the test name is misleading.

Minor

  • Inconsistent logger category names across tests: "test", "category", and "cat" are used for the same conceptual placeholder.
  • Three internal interface helpers are declared at file scope; nesting them inside LoggingManagerTests would better scope them.

Positive Highlights

  • Clean Arrange/Act/Assert structure throughout both test files.
  • Good coverage of null parameters, enabled/disabled providers, and initializable variants.
  • The modification to TestExtension to accept a configurable uid via constructor is a well-thought-out change to enable richer test scenarios.

Generated by PR Nitpick Reviewer

🔍 Meticulously inspected by PR Nitpick Reviewer 🔍

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

Pull request overview

Adds missing unit test coverage in Microsoft.Testing.Platform.UnitTests for two internal helpers in Microsoft.Testing.Platform: LoggingManager.BuildAsync (provider inclusion/initialization behavior) and ExtensionValidationHelper.ValidateUniqueExtension (duplicate UID detection and message content), plus a small enhancement to the TestExtension test helper to allow configurable UIDs.

Changes:

  • Add LoggingManagerTests covering enabled/disabled extension providers, initialization behavior, and factory argument propagation.
  • Add ExtensionValidationHelperTests covering null validation, duplicate detection for both overloads, selector-based collections, and error message content.
  • Update TestExtension helper to accept an optional uid constructor parameter for easier test setup.
Show a summary per file
FileDescription
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Logging/LoggingManagerTests.csNew tests validating LoggingManager.BuildAsync provider filtering, initialization, and propagation of log level/service provider.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/TestExtension.csEnhances the test helper to support configurable Uid values.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/ExtensionValidationHelperTests.csNew tests validating ValidateUniqueExtension duplicate detection (both overloads) and error message contents.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: Expert Code Reviewer
Date: 2026-05-11
Repository: microsoft/testfx

Review

PR #8125 adds 25 unit tests for two internal components:

  • LoggingManager.BuildAsync (10 tests): Covers provider inclusion/exclusion based on IExtension.IsEnabledAsync(), initialization ordering via IAsyncInitializableExtension.TryInitializeAsync(), log level and service provider propagation, and null argument validation.
  • ExtensionValidationHelper.ValidateUniqueExtension (15 tests): Covers both overloads (direct and selector-based), null argument guards, empty collections, non-duplicate pass-through, duplicate detection, and error message content.

Key Findings

No issues found in any of the review categories.

Verified correct:

  • All async test assertions properly awaitBuildAsync, which chains through IsEnabledAsync() and TryInitializeAsync() correctly.
  • Assert.Contains(substring, value) parameter order is correct per MSTest's string overload signature (substring first, container second).
  • LoggerFactory.CreateLogger caches per category — Times.Once verifications are accurate.
  • IExtensionLoggerProvider, IExtensionInitializableLoggerProvider, and IInitializableLoggerProvider test-internal interface declarations are unique in the namespace and correctly compose IExtension + IAsyncInitializableExtension to trigger the right branches in BuildAsync.
  • TestExtension.cs refactor (constructor-based Uid with default "Uid") is backward-compatible with all existing usages.
  • Mock<IMonitor> setup in the test constructor returns a valid IDisposable for LoggerFactory's using (_monitor.Lock(...)) pattern.
  • Moq 4.18.4 default behavior for Task-returning methods returns Task.CompletedTask — explicit setups are correct (and redundant ones are harmless).

Recommendations

None — the tests are well-structured and correctly exercise the production code paths.


Generated by Expert Code Reviewer

🧠 Reviewed by Expert Code Reviewer 🧠

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: Test Expert Reviewer 🧪
Date: 2026-05-11
Repository: microsoft/testfx

Key Findings

  1. [Assertion]ValidateUniqueExtension_WithDuplicateUid_ErrorMessageContainsBothTypeNames — the test name promises verification of two distinct type names in the error message, but both extensions are TestExtension and only one Assert.Contains is made. This is misleading: if the production code omitted one type name, the test would still pass.

  2. [Coverage]LoggingManagerTests covers null validation for AddProvider but not for BuildAsync itself. If BuildAsync guards its serviceProvider or monitor parameters against null, those guards have no test coverage.

Recommendations

  • For finding 1: either rename the test to ...ErrorMessageContainsTypeName or introduce two different concrete IExtension types with two separate Assert.Contains calls.
  • For finding 2: add BuildAsync_WithNullServiceProvider_ThrowsArgumentNullException and BuildAsync_WithNullMonitor_ThrowsArgumentNullException if those null guards exist in the production code.

Overall the tests are well-structured, properly isolated (MSTest new-instance-per-test, no shared mutable state), use the correct assertion APIs for this project, and cover the key happy/sad paths for both LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension.


Generated by Test Expert Reviewer

🧪 Test quality reviewed by Test Expert Reviewer 🧪

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Copilot address review comments

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
CopilotAI review requested due to automatic review settings May 11, 2026 15:45
@Evangelink
Amaury Levé (Evangelink) removed the request for review from CopilotMay 11, 2026 15:45

CopilotAI commented May 11, 2026

Copy link
Copy Markdown
Contributor

Copilot address review comments

Done in f8180d9. I addressed the remaining review comment on LoggingManagerTests by explicitly setting up InitializeAsync on the disabled-provider mock and validated with targeted tests.

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Copilot resolve the merge conflicts in this pull request

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
CopilotAI review requested due to automatic review settings May 11, 2026 16:40
@Evangelink
Amaury Levé (Evangelink) removed the request for review from CopilotMay 11, 2026 16:40

CopilotAI commented May 11, 2026

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

Resolved in d64e3c6: merged origin/main into this branch and resolved the conflicts in the two test files.

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Note

The pull request was not created — a fallback review issue was created instead due to protected file changes: #8140

🤖 Test Improver here. Status update: the work in this PR has been superseded. The LoggingManager tests landed in main via #8124 and #8130, and the ExtensionValidationHelper tests landed via #8128.

This PR is a duplicate of merged work — it can be safely closed.

Generated by Daily Test Improver · ● 9.5M ·

…anager-extension-validation-tests-853aaedb3e22557c
@Evangelink
Amaury Levé (Evangelink) merged commit 455986a into mainMay 13, 2026
10 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c branch May 13, 2026 12:58
Sign up for freeto 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.

3 participants

@Evangelink
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

[Test Improver] test: add unit tests for LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension - #8125

Merged
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c
May 13, 2026
Merged

[Test Improver] test: add unit tests for LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension#8125
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c

Conversation

@Evangelink

@EvangelinkAmaury Levé (Evangelink) commented May 11, 2026

Copy link
Copy Markdown
Member

Adds focused unit test coverage in Microsoft.Testing.Platform.UnitTests for:

  • LoggingManager.BuildAsync (provider inclusion/exclusion, initialization behavior, and factory argument propagation)
  • ExtensionValidationHelper.ValidateUniqueExtension (null guards, duplicate UID detection, and error message assertions)

Also includes follow-up review feedback fixes:

  • Renamed the duplicate-UID type-name test to match what it asserts.
  • Standardized logger category literals in LoggingManagerTests.
  • Scoped test-only helper interfaces inside LoggingManagerTests.
  • Added explicit InitializeAsync setup in the disabled-provider test to keep regression failures actionable.

Finally, this PR branch was merged with main and merge conflicts were resolved in the two new test files without changing the intended test coverage scope.

…ationHelper.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>
CopilotAI review requested due to automatic review settings May 11, 2026 14:41

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: PR Nitpick Reviewer 🔍
Date: 2026-05-11
Repository: microsoft/testfx

Key Findings

Important

  • ValidateUniqueExtension_WithDuplicateUid_ErrorMessageContainsBothTypeNames asserts only one type name: both existing[0] and newExtension are the same type (TestExtension), so the test name is misleading.

Minor

  • Inconsistent logger category names across tests: "test", "category", and "cat" are used for the same conceptual placeholder.
  • Three internal interface helpers are declared at file scope; nesting them inside LoggingManagerTests would better scope them.

Positive Highlights

  • Clean Arrange/Act/Assert structure throughout both test files.
  • Good coverage of null parameters, enabled/disabled providers, and initializable variants.
  • The modification to TestExtension to accept a configurable uid via constructor is a well-thought-out change to enable richer test scenarios.

Generated by PR Nitpick Reviewer

🔍 Meticulously inspected by PR Nitpick Reviewer 🔍

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

Pull request overview

Adds missing unit test coverage in Microsoft.Testing.Platform.UnitTests for two internal helpers in Microsoft.Testing.Platform: LoggingManager.BuildAsync (provider inclusion/initialization behavior) and ExtensionValidationHelper.ValidateUniqueExtension (duplicate UID detection and message content), plus a small enhancement to the TestExtension test helper to allow configurable UIDs.

Changes:

  • Add LoggingManagerTests covering enabled/disabled extension providers, initialization behavior, and factory argument propagation.
  • Add ExtensionValidationHelperTests covering null validation, duplicate detection for both overloads, selector-based collections, and error message content.
  • Update TestExtension helper to accept an optional uid constructor parameter for easier test setup.
Show a summary per file
FileDescription
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Logging/LoggingManagerTests.csNew tests validating LoggingManager.BuildAsync provider filtering, initialization, and propagation of log level/service provider.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/TestExtension.csEnhances the test helper to support configurable Uid values.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/ExtensionValidationHelperTests.csNew tests validating ValidateUniqueExtension duplicate detection (both overloads) and error message contents.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: Expert Code Reviewer
Date: 2026-05-11
Repository: microsoft/testfx

Review

PR #8125 adds 25 unit tests for two internal components:

  • LoggingManager.BuildAsync (10 tests): Covers provider inclusion/exclusion based on IExtension.IsEnabledAsync(), initialization ordering via IAsyncInitializableExtension.TryInitializeAsync(), log level and service provider propagation, and null argument validation.
  • ExtensionValidationHelper.ValidateUniqueExtension (15 tests): Covers both overloads (direct and selector-based), null argument guards, empty collections, non-duplicate pass-through, duplicate detection, and error message content.

Key Findings

No issues found in any of the review categories.

Verified correct:

  • All async test assertions properly awaitBuildAsync, which chains through IsEnabledAsync() and TryInitializeAsync() correctly.
  • Assert.Contains(substring, value) parameter order is correct per MSTest's string overload signature (substring first, container second).
  • LoggerFactory.CreateLogger caches per category — Times.Once verifications are accurate.
  • IExtensionLoggerProvider, IExtensionInitializableLoggerProvider, and IInitializableLoggerProvider test-internal interface declarations are unique in the namespace and correctly compose IExtension + IAsyncInitializableExtension to trigger the right branches in BuildAsync.
  • TestExtension.cs refactor (constructor-based Uid with default "Uid") is backward-compatible with all existing usages.
  • Mock<IMonitor> setup in the test constructor returns a valid IDisposable for LoggerFactory's using (_monitor.Lock(...)) pattern.
  • Moq 4.18.4 default behavior for Task-returning methods returns Task.CompletedTask — explicit setups are correct (and redundant ones are harmless).

Recommendations

None — the tests are well-structured and correctly exercise the production code paths.


Generated by Expert Code Reviewer

🧠 Reviewed by Expert Code Reviewer 🧠

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: Test Expert Reviewer 🧪
Date: 2026-05-11
Repository: microsoft/testfx

Key Findings

  1. [Assertion]ValidateUniqueExtension_WithDuplicateUid_ErrorMessageContainsBothTypeNames — the test name promises verification of two distinct type names in the error message, but both extensions are TestExtension and only one Assert.Contains is made. This is misleading: if the production code omitted one type name, the test would still pass.

  2. [Coverage]LoggingManagerTests covers null validation for AddProvider but not for BuildAsync itself. If BuildAsync guards its serviceProvider or monitor parameters against null, those guards have no test coverage.

Recommendations

  • For finding 1: either rename the test to ...ErrorMessageContainsTypeName or introduce two different concrete IExtension types with two separate Assert.Contains calls.
  • For finding 2: add BuildAsync_WithNullServiceProvider_ThrowsArgumentNullException and BuildAsync_WithNullMonitor_ThrowsArgumentNullException if those null guards exist in the production code.

Overall the tests are well-structured, properly isolated (MSTest new-instance-per-test, no shared mutable state), use the correct assertion APIs for this project, and cover the key happy/sad paths for both LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension.


Generated by Test Expert Reviewer

🧪 Test quality reviewed by Test Expert Reviewer 🧪

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Copilot address review comments

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
CopilotAI review requested due to automatic review settings May 11, 2026 15:45
@Evangelink
Amaury Levé (Evangelink) removed the request for review from CopilotMay 11, 2026 15:45

CopilotAI commented May 11, 2026

Copy link
Copy Markdown
Contributor

Copilot address review comments

Done in f8180d9. I addressed the remaining review comment on LoggingManagerTests by explicitly setting up InitializeAsync on the disabled-provider mock and validated with targeted tests.

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Copilot resolve the merge conflicts in this pull request

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
CopilotAI review requested due to automatic review settings May 11, 2026 16:40
@Evangelink
Amaury Levé (Evangelink) removed the request for review from CopilotMay 11, 2026 16:40

CopilotAI commented May 11, 2026

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

Resolved in d64e3c6: merged origin/main into this branch and resolved the conflicts in the two test files.

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Note

The pull request was not created — a fallback review issue was created instead due to protected file changes: #8140

🤖 Test Improver here. Status update: the work in this PR has been superseded. The LoggingManager tests landed in main via #8124 and #8130, and the ExtensionValidationHelper tests landed via #8128.

This PR is a duplicate of merged work — it can be safely closed.

Generated by Daily Test Improver · ● 9.5M ·

…anager-extension-validation-tests-853aaedb3e22557c
@Evangelink
Amaury Levé (Evangelink) merged commit 455986a into mainMay 13, 2026
10 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c branch May 13, 2026 12:58
Sign up for freeto 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.

3 participants

@Evangelink
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[Test Improver] test: add unit tests for LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension - #8125

Merged
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c
May 13, 2026
Merged

[Test Improver] test: add unit tests for LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension#8125
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c

Conversation

@Evangelink

@EvangelinkAmaury Levé (Evangelink) commented May 11, 2026

Copy link
Copy Markdown
Member

Adds focused unit test coverage in Microsoft.Testing.Platform.UnitTests for:

  • LoggingManager.BuildAsync (provider inclusion/exclusion, initialization behavior, and factory argument propagation)
  • ExtensionValidationHelper.ValidateUniqueExtension (null guards, duplicate UID detection, and error message assertions)

Also includes follow-up review feedback fixes:

  • Renamed the duplicate-UID type-name test to match what it asserts.
  • Standardized logger category literals in LoggingManagerTests.
  • Scoped test-only helper interfaces inside LoggingManagerTests.
  • Added explicit InitializeAsync setup in the disabled-provider test to keep regression failures actionable.

Finally, this PR branch was merged with main and merge conflicts were resolved in the two new test files without changing the intended test coverage scope.

…ationHelper.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>
CopilotAI review requested due to automatic review settings May 11, 2026 14:41

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: PR Nitpick Reviewer 🔍
Date: 2026-05-11
Repository: microsoft/testfx

Key Findings

Important

  • ValidateUniqueExtension_WithDuplicateUid_ErrorMessageContainsBothTypeNames asserts only one type name: both existing[0] and newExtension are the same type (TestExtension), so the test name is misleading.

Minor

  • Inconsistent logger category names across tests: "test", "category", and "cat" are used for the same conceptual placeholder.
  • Three internal interface helpers are declared at file scope; nesting them inside LoggingManagerTests would better scope them.

Positive Highlights

  • Clean Arrange/Act/Assert structure throughout both test files.
  • Good coverage of null parameters, enabled/disabled providers, and initializable variants.
  • The modification to TestExtension to accept a configurable uid via constructor is a well-thought-out change to enable richer test scenarios.

Generated by PR Nitpick Reviewer

🔍 Meticulously inspected by PR Nitpick Reviewer 🔍

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

Pull request overview

Adds missing unit test coverage in Microsoft.Testing.Platform.UnitTests for two internal helpers in Microsoft.Testing.Platform: LoggingManager.BuildAsync (provider inclusion/initialization behavior) and ExtensionValidationHelper.ValidateUniqueExtension (duplicate UID detection and message content), plus a small enhancement to the TestExtension test helper to allow configurable UIDs.

Changes:

  • Add LoggingManagerTests covering enabled/disabled extension providers, initialization behavior, and factory argument propagation.
  • Add ExtensionValidationHelperTests covering null validation, duplicate detection for both overloads, selector-based collections, and error message content.
  • Update TestExtension helper to accept an optional uid constructor parameter for easier test setup.
Show a summary per file
FileDescription
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Logging/LoggingManagerTests.csNew tests validating LoggingManager.BuildAsync provider filtering, initialization, and propagation of log level/service provider.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/TestExtension.csEnhances the test helper to support configurable Uid values.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/ExtensionValidationHelperTests.csNew tests validating ValidateUniqueExtension duplicate detection (both overloads) and error message contents.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: Expert Code Reviewer
Date: 2026-05-11
Repository: microsoft/testfx

Review

PR #8125 adds 25 unit tests for two internal components:

  • LoggingManager.BuildAsync (10 tests): Covers provider inclusion/exclusion based on IExtension.IsEnabledAsync(), initialization ordering via IAsyncInitializableExtension.TryInitializeAsync(), log level and service provider propagation, and null argument validation.
  • ExtensionValidationHelper.ValidateUniqueExtension (15 tests): Covers both overloads (direct and selector-based), null argument guards, empty collections, non-duplicate pass-through, duplicate detection, and error message content.

Key Findings

No issues found in any of the review categories.

Verified correct:

  • All async test assertions properly awaitBuildAsync, which chains through IsEnabledAsync() and TryInitializeAsync() correctly.
  • Assert.Contains(substring, value) parameter order is correct per MSTest's string overload signature (substring first, container second).
  • LoggerFactory.CreateLogger caches per category — Times.Once verifications are accurate.
  • IExtensionLoggerProvider, IExtensionInitializableLoggerProvider, and IInitializableLoggerProvider test-internal interface declarations are unique in the namespace and correctly compose IExtension + IAsyncInitializableExtension to trigger the right branches in BuildAsync.
  • TestExtension.cs refactor (constructor-based Uid with default "Uid") is backward-compatible with all existing usages.
  • Mock<IMonitor> setup in the test constructor returns a valid IDisposable for LoggerFactory's using (_monitor.Lock(...)) pattern.
  • Moq 4.18.4 default behavior for Task-returning methods returns Task.CompletedTask — explicit setups are correct (and redundant ones are harmless).

Recommendations

None — the tests are well-structured and correctly exercise the production code paths.


Generated by Expert Code Reviewer

🧠 Reviewed by Expert Code Reviewer 🧠

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: Test Expert Reviewer 🧪
Date: 2026-05-11
Repository: microsoft/testfx

Key Findings

  1. [Assertion]ValidateUniqueExtension_WithDuplicateUid_ErrorMessageContainsBothTypeNames — the test name promises verification of two distinct type names in the error message, but both extensions are TestExtension and only one Assert.Contains is made. This is misleading: if the production code omitted one type name, the test would still pass.

  2. [Coverage]LoggingManagerTests covers null validation for AddProvider but not for BuildAsync itself. If BuildAsync guards its serviceProvider or monitor parameters against null, those guards have no test coverage.

Recommendations

  • For finding 1: either rename the test to ...ErrorMessageContainsTypeName or introduce two different concrete IExtension types with two separate Assert.Contains calls.
  • For finding 2: add BuildAsync_WithNullServiceProvider_ThrowsArgumentNullException and BuildAsync_WithNullMonitor_ThrowsArgumentNullException if those null guards exist in the production code.

Overall the tests are well-structured, properly isolated (MSTest new-instance-per-test, no shared mutable state), use the correct assertion APIs for this project, and cover the key happy/sad paths for both LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension.


Generated by Test Expert Reviewer

🧪 Test quality reviewed by Test Expert Reviewer 🧪

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Copilot address review comments

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
CopilotAI review requested due to automatic review settings May 11, 2026 15:45
@Evangelink
Amaury Levé (Evangelink) removed the request for review from CopilotMay 11, 2026 15:45

CopilotAI commented May 11, 2026

Copy link
Copy Markdown
Contributor

Copilot address review comments

Done in f8180d9. I addressed the remaining review comment on LoggingManagerTests by explicitly setting up InitializeAsync on the disabled-provider mock and validated with targeted tests.

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Copilot resolve the merge conflicts in this pull request

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
CopilotAI review requested due to automatic review settings May 11, 2026 16:40
@Evangelink
Amaury Levé (Evangelink) removed the request for review from CopilotMay 11, 2026 16:40

CopilotAI commented May 11, 2026

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

Resolved in d64e3c6: merged origin/main into this branch and resolved the conflicts in the two test files.

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Note

The pull request was not created — a fallback review issue was created instead due to protected file changes: #8140

🤖 Test Improver here. Status update: the work in this PR has been superseded. The LoggingManager tests landed in main via #8124 and #8130, and the ExtensionValidationHelper tests landed via #8128.

This PR is a duplicate of merged work — it can be safely closed.

Generated by Daily Test Improver · ● 9.5M ·

…anager-extension-validation-tests-853aaedb3e22557c
@Evangelink
Amaury Levé (Evangelink) merged commit 455986a into mainMay 13, 2026
10 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c branch May 13, 2026 12:58
Sign up for freeto 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.

3 participants

@Evangelink
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[Test Improver] test: add unit tests for LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension - #8125

Merged
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c
May 13, 2026
Merged

[Test Improver] test: add unit tests for LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension#8125
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c

Conversation

@Evangelink

@EvangelinkAmaury Levé (Evangelink) commented May 11, 2026

Copy link
Copy Markdown
Member

Adds focused unit test coverage in Microsoft.Testing.Platform.UnitTests for:

  • LoggingManager.BuildAsync (provider inclusion/exclusion, initialization behavior, and factory argument propagation)
  • ExtensionValidationHelper.ValidateUniqueExtension (null guards, duplicate UID detection, and error message assertions)

Also includes follow-up review feedback fixes:

  • Renamed the duplicate-UID type-name test to match what it asserts.
  • Standardized logger category literals in LoggingManagerTests.
  • Scoped test-only helper interfaces inside LoggingManagerTests.
  • Added explicit InitializeAsync setup in the disabled-provider test to keep regression failures actionable.

Finally, this PR branch was merged with main and merge conflicts were resolved in the two new test files without changing the intended test coverage scope.

…ationHelper.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>
CopilotAI review requested due to automatic review settings May 11, 2026 14:41

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: PR Nitpick Reviewer 🔍
Date: 2026-05-11
Repository: microsoft/testfx

Key Findings

Important

  • ValidateUniqueExtension_WithDuplicateUid_ErrorMessageContainsBothTypeNames asserts only one type name: both existing[0] and newExtension are the same type (TestExtension), so the test name is misleading.

Minor

  • Inconsistent logger category names across tests: "test", "category", and "cat" are used for the same conceptual placeholder.
  • Three internal interface helpers are declared at file scope; nesting them inside LoggingManagerTests would better scope them.

Positive Highlights

  • Clean Arrange/Act/Assert structure throughout both test files.
  • Good coverage of null parameters, enabled/disabled providers, and initializable variants.
  • The modification to TestExtension to accept a configurable uid via constructor is a well-thought-out change to enable richer test scenarios.

Generated by PR Nitpick Reviewer

🔍 Meticulously inspected by PR Nitpick Reviewer 🔍

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

Pull request overview

Adds missing unit test coverage in Microsoft.Testing.Platform.UnitTests for two internal helpers in Microsoft.Testing.Platform: LoggingManager.BuildAsync (provider inclusion/initialization behavior) and ExtensionValidationHelper.ValidateUniqueExtension (duplicate UID detection and message content), plus a small enhancement to the TestExtension test helper to allow configurable UIDs.

Changes:

  • Add LoggingManagerTests covering enabled/disabled extension providers, initialization behavior, and factory argument propagation.
  • Add ExtensionValidationHelperTests covering null validation, duplicate detection for both overloads, selector-based collections, and error message content.
  • Update TestExtension helper to accept an optional uid constructor parameter for easier test setup.
Show a summary per file
FileDescription
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Logging/LoggingManagerTests.csNew tests validating LoggingManager.BuildAsync provider filtering, initialization, and propagation of log level/service provider.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/TestExtension.csEnhances the test helper to support configurable Uid values.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/ExtensionValidationHelperTests.csNew tests validating ValidateUniqueExtension duplicate detection (both overloads) and error message contents.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: Expert Code Reviewer
Date: 2026-05-11
Repository: microsoft/testfx

Review

PR #8125 adds 25 unit tests for two internal components:

  • LoggingManager.BuildAsync (10 tests): Covers provider inclusion/exclusion based on IExtension.IsEnabledAsync(), initialization ordering via IAsyncInitializableExtension.TryInitializeAsync(), log level and service provider propagation, and null argument validation.
  • ExtensionValidationHelper.ValidateUniqueExtension (15 tests): Covers both overloads (direct and selector-based), null argument guards, empty collections, non-duplicate pass-through, duplicate detection, and error message content.

Key Findings

No issues found in any of the review categories.

Verified correct:

  • All async test assertions properly awaitBuildAsync, which chains through IsEnabledAsync() and TryInitializeAsync() correctly.
  • Assert.Contains(substring, value) parameter order is correct per MSTest's string overload signature (substring first, container second).
  • LoggerFactory.CreateLogger caches per category — Times.Once verifications are accurate.
  • IExtensionLoggerProvider, IExtensionInitializableLoggerProvider, and IInitializableLoggerProvider test-internal interface declarations are unique in the namespace and correctly compose IExtension + IAsyncInitializableExtension to trigger the right branches in BuildAsync.
  • TestExtension.cs refactor (constructor-based Uid with default "Uid") is backward-compatible with all existing usages.
  • Mock<IMonitor> setup in the test constructor returns a valid IDisposable for LoggerFactory's using (_monitor.Lock(...)) pattern.
  • Moq 4.18.4 default behavior for Task-returning methods returns Task.CompletedTask — explicit setups are correct (and redundant ones are harmless).

Recommendations

None — the tests are well-structured and correctly exercise the production code paths.


Generated by Expert Code Reviewer

🧠 Reviewed by Expert Code Reviewer 🧠

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: Test Expert Reviewer 🧪
Date: 2026-05-11
Repository: microsoft/testfx

Key Findings

  1. [Assertion]ValidateUniqueExtension_WithDuplicateUid_ErrorMessageContainsBothTypeNames — the test name promises verification of two distinct type names in the error message, but both extensions are TestExtension and only one Assert.Contains is made. This is misleading: if the production code omitted one type name, the test would still pass.

  2. [Coverage]LoggingManagerTests covers null validation for AddProvider but not for BuildAsync itself. If BuildAsync guards its serviceProvider or monitor parameters against null, those guards have no test coverage.

Recommendations

  • For finding 1: either rename the test to ...ErrorMessageContainsTypeName or introduce two different concrete IExtension types with two separate Assert.Contains calls.
  • For finding 2: add BuildAsync_WithNullServiceProvider_ThrowsArgumentNullException and BuildAsync_WithNullMonitor_ThrowsArgumentNullException if those null guards exist in the production code.

Overall the tests are well-structured, properly isolated (MSTest new-instance-per-test, no shared mutable state), use the correct assertion APIs for this project, and cover the key happy/sad paths for both LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension.


Generated by Test Expert Reviewer

🧪 Test quality reviewed by Test Expert Reviewer 🧪

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Copilot address review comments

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
CopilotAI review requested due to automatic review settings May 11, 2026 15:45
@Evangelink
Amaury Levé (Evangelink) removed the request for review from CopilotMay 11, 2026 15:45

CopilotAI commented May 11, 2026

Copy link
Copy Markdown
Contributor

Copilot address review comments

Done in f8180d9. I addressed the remaining review comment on LoggingManagerTests by explicitly setting up InitializeAsync on the disabled-provider mock and validated with targeted tests.

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Copilot resolve the merge conflicts in this pull request

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
CopilotAI review requested due to automatic review settings May 11, 2026 16:40
@Evangelink
Amaury Levé (Evangelink) removed the request for review from CopilotMay 11, 2026 16:40

CopilotAI commented May 11, 2026

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

Resolved in d64e3c6: merged origin/main into this branch and resolved the conflicts in the two test files.

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Note

The pull request was not created — a fallback review issue was created instead due to protected file changes: #8140

🤖 Test Improver here. Status update: the work in this PR has been superseded. The LoggingManager tests landed in main via #8124 and #8130, and the ExtensionValidationHelper tests landed via #8128.

This PR is a duplicate of merged work — it can be safely closed.

Generated by Daily Test Improver · ● 9.5M ·

…anager-extension-validation-tests-853aaedb3e22557c
@Evangelink
Amaury Levé (Evangelink) merged commit 455986a into mainMay 13, 2026
10 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c branch May 13, 2026 12:58
Sign up for freeto 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.

3 participants

@Evangelink
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

[Test Improver] test: add unit tests for LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension - #8125

Merged
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c
May 13, 2026
Merged

[Test Improver] test: add unit tests for LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension#8125
Amaury Levé (Evangelink) merged 5 commits into
mainfrom
test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c

Conversation

@Evangelink

@EvangelinkAmaury Levé (Evangelink) commented May 11, 2026

Copy link
Copy Markdown
Member

Adds focused unit test coverage in Microsoft.Testing.Platform.UnitTests for:

  • LoggingManager.BuildAsync (provider inclusion/exclusion, initialization behavior, and factory argument propagation)
  • ExtensionValidationHelper.ValidateUniqueExtension (null guards, duplicate UID detection, and error message assertions)

Also includes follow-up review feedback fixes:

  • Renamed the duplicate-UID type-name test to match what it asserts.
  • Standardized logger category literals in LoggingManagerTests.
  • Scoped test-only helper interfaces inside LoggingManagerTests.
  • Added explicit InitializeAsync setup in the disabled-provider test to keep regression failures actionable.

Finally, this PR branch was merged with main and merge conflicts were resolved in the two new test files without changing the intended test coverage scope.

…ationHelper.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>
CopilotAI review requested due to automatic review settings May 11, 2026 14:41

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: PR Nitpick Reviewer 🔍
Date: 2026-05-11
Repository: microsoft/testfx

Key Findings

Important

  • ValidateUniqueExtension_WithDuplicateUid_ErrorMessageContainsBothTypeNames asserts only one type name: both existing[0] and newExtension are the same type (TestExtension), so the test name is misleading.

Minor

  • Inconsistent logger category names across tests: "test", "category", and "cat" are used for the same conceptual placeholder.
  • Three internal interface helpers are declared at file scope; nesting them inside LoggingManagerTests would better scope them.

Positive Highlights

  • Clean Arrange/Act/Assert structure throughout both test files.
  • Good coverage of null parameters, enabled/disabled providers, and initializable variants.
  • The modification to TestExtension to accept a configurable uid via constructor is a well-thought-out change to enable richer test scenarios.

Generated by PR Nitpick Reviewer

🔍 Meticulously inspected by PR Nitpick Reviewer 🔍

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

Pull request overview

Adds missing unit test coverage in Microsoft.Testing.Platform.UnitTests for two internal helpers in Microsoft.Testing.Platform: LoggingManager.BuildAsync (provider inclusion/initialization behavior) and ExtensionValidationHelper.ValidateUniqueExtension (duplicate UID detection and message content), plus a small enhancement to the TestExtension test helper to allow configurable UIDs.

Changes:

  • Add LoggingManagerTests covering enabled/disabled extension providers, initialization behavior, and factory argument propagation.
  • Add ExtensionValidationHelperTests covering null validation, duplicate detection for both overloads, selector-based collections, and error message content.
  • Update TestExtension helper to accept an optional uid constructor parameter for easier test setup.
Show a summary per file
FileDescription
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Logging/LoggingManagerTests.csNew tests validating LoggingManager.BuildAsync provider filtering, initialization, and propagation of log level/service provider.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/TestExtension.csEnhances the test helper to support configurable Uid values.
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Helpers/ExtensionValidationHelperTests.csNew tests validating ValidateUniqueExtension duplicate detection (both overloads) and error message contents.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: Expert Code Reviewer
Date: 2026-05-11
Repository: microsoft/testfx

Review

PR #8125 adds 25 unit tests for two internal components:

  • LoggingManager.BuildAsync (10 tests): Covers provider inclusion/exclusion based on IExtension.IsEnabledAsync(), initialization ordering via IAsyncInitializableExtension.TryInitializeAsync(), log level and service provider propagation, and null argument validation.
  • ExtensionValidationHelper.ValidateUniqueExtension (15 tests): Covers both overloads (direct and selector-based), null argument guards, empty collections, non-duplicate pass-through, duplicate detection, and error message content.

Key Findings

No issues found in any of the review categories.

Verified correct:

  • All async test assertions properly awaitBuildAsync, which chains through IsEnabledAsync() and TryInitializeAsync() correctly.
  • Assert.Contains(substring, value) parameter order is correct per MSTest's string overload signature (substring first, container second).
  • LoggerFactory.CreateLogger caches per category — Times.Once verifications are accurate.
  • IExtensionLoggerProvider, IExtensionInitializableLoggerProvider, and IInitializableLoggerProvider test-internal interface declarations are unique in the namespace and correctly compose IExtension + IAsyncInitializableExtension to trigger the right branches in BuildAsync.
  • TestExtension.cs refactor (constructor-based Uid with default "Uid") is backward-compatible with all existing usages.
  • Mock<IMonitor> setup in the test constructor returns a valid IDisposable for LoggerFactory's using (_monitor.Lock(...)) pattern.
  • Moq 4.18.4 default behavior for Task-returning methods returns Task.CompletedTask — explicit setups are correct (and redundant ones are harmless).

Recommendations

None — the tests are well-structured and correctly exercise the production code paths.


Generated by Expert Code Reviewer

🧠 Reviewed by Expert Code Reviewer 🧠

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Summary

Workflow: Test Expert Reviewer 🧪
Date: 2026-05-11
Repository: microsoft/testfx

Key Findings

  1. [Assertion]ValidateUniqueExtension_WithDuplicateUid_ErrorMessageContainsBothTypeNames — the test name promises verification of two distinct type names in the error message, but both extensions are TestExtension and only one Assert.Contains is made. This is misleading: if the production code omitted one type name, the test would still pass.

  2. [Coverage]LoggingManagerTests covers null validation for AddProvider but not for BuildAsync itself. If BuildAsync guards its serviceProvider or monitor parameters against null, those guards have no test coverage.

Recommendations

  • For finding 1: either rename the test to ...ErrorMessageContainsTypeName or introduce two different concrete IExtension types with two separate Assert.Contains calls.
  • For finding 2: add BuildAsync_WithNullServiceProvider_ThrowsArgumentNullException and BuildAsync_WithNullMonitor_ThrowsArgumentNullException if those null guards exist in the production code.

Overall the tests are well-structured, properly isolated (MSTest new-instance-per-test, no shared mutable state), use the correct assertion APIs for this project, and cover the key happy/sad paths for both LoggingManager.BuildAsync and ExtensionValidationHelper.ValidateUniqueExtension.


Generated by Test Expert Reviewer

🧪 Test quality reviewed by Test Expert Reviewer 🧪

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Copilot address review comments

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
CopilotAI review requested due to automatic review settings May 11, 2026 15:45
@Evangelink
Amaury Levé (Evangelink) removed the request for review from CopilotMay 11, 2026 15:45

CopilotAI commented May 11, 2026

Copy link
Copy Markdown
Contributor

Copilot address review comments

Done in f8180d9. I addressed the remaining review comment on LoggingManagerTests by explicitly setting up InitializeAsync on the disabled-provider mock and validated with targeted tests.

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Copilot resolve the merge conflicts in this pull request

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
CopilotAI review requested due to automatic review settings May 11, 2026 16:40
@Evangelink
Amaury Levé (Evangelink) removed the request for review from CopilotMay 11, 2026 16:40

CopilotAI commented May 11, 2026

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

Resolved in d64e3c6: merged origin/main into this branch and resolved the conflicts in the two test files.

@Evangelink

Copy link
Copy Markdown
MemberAuthor

Note

The pull request was not created — a fallback review issue was created instead due to protected file changes: #8140

🤖 Test Improver here. Status update: the work in this PR has been superseded. The LoggingManager tests landed in main via #8124 and #8130, and the ExtensionValidationHelper tests landed via #8128.

This PR is a duplicate of merged work — it can be safely closed.

Generated by Daily Test Improver · ● 9.5M ·

…anager-extension-validation-tests-853aaedb3e22557c
@Evangelink
Amaury Levé (Evangelink) merged commit 455986a into mainMay 13, 2026
10 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the test-assist/logging-manager-extension-validation-tests-853aaedb3e22557c branch May 13, 2026 12:58
Sign up for freeto 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.

3 participants

@Evangelink