-
Notifications
You must be signed in to change notification settings - Fork 1
V9.1.1/inconvenience fixes #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe pull request updates package versions from 9.1.0 to 9.1.1 and enhances framework availability documentation across several NuGet packages. Release notes and the changelog now include additional dependency and bug fix details as well as new feature notes. Constructors in host test classes have been modified to accept a boolean flag to optionally skip fixture initialization, streamlining initialization flows. Logging functionality is improved with a new overload that accepts an optional category name, and tests have been updated to reflect these changes. Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as Test/Client
participant TestClass as HostTest/AspNetCoreHostTest
participant Fixture as HostFixture
Caller->>TestClass: Instantiate with (skipHostFixtureInitialization flag)
alt skipHostFixtureInitialization == true
TestClass-->>Caller: Return instance without initialization
else skipHostFixtureInitialization == false
TestClass->>Fixture: Check fixture validity
Fixture-->>TestClass: Return state (valid/invalid)
alt Fixture is invalid
TestClass->>Fixture: Set configuration callbacks
TestClass->>Fixture: Call ConfigureHost
end
TestClass->>TestClass: Assign Host, ServiceProvider, Application
TestClass->>TestClass: Call Configure with configuration & environment
TestClass-->>Caller: Return fully initialized instance
end
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (21)
💤 Files with no reviewable changes (5)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request updates the version to 9.1.1 and refactors host fixture initialization logic, adds a new ILogger extension overload, and includes minor improvements to logging functionality.
- Removed duplicate and redundant host fixture initialization in various test files.
- Added a new GetTestStore overload that accepts an optional categoryName parameter and updated associated logging classes.
- Updated HostFixture to set the application name from the caller's assembly and improved constructor overloads to allow skipping host fixture initialization.
Reviewed Changes
Copilot reviewed 17 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/Codebelt.Extensions.Xunit.Hosting.Tests/HostTestTest.cs | Removed redundant host fixture initialization in favor of the new constructor overload. |
| test/Codebelt.Extensions.Xunit.Hosting.Tests/GenericHostTestFactoryTest.cs | Added tests for the new GenericHostTestFactory behavior. |
| test/Codebelt.Extensions.Xunit.Hosting.Tests/Assets/ValidHostTest.cs | Simplified initialization by removing duplicate setup code. |
| test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/WebHostTestFactoryTest.cs | Updated GetTestStore call to include a null categoryName parameter. |
| test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MvcAspNetCoreHostTestTest.cs | Removed redundant host fixture initialization code. |
| test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/Assets/ValidHostTest.cs | Simplified initialization by removing duplicate setup calls. |
| test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/AspNetCoreHostTestTest.cs | Removed redundant host fixture initialization code. |
| src/Codebelt.Extensions.Xunit.Hosting/XunitTestLoggerProvider.cs | Updated logger provider with string comparer and added an indexer to retrieve stores by category name. |
| src/Codebelt.Extensions.Xunit.Hosting/XunitTestLogger.cs | Modified logger to inherit from InMemoryTestStore and added logging entries directly. |
| src/Codebelt.Extensions.Xunit.Hosting/LoggerExtensions.cs | Added a new GetTestStore overload that accepts an optional category name and updated the obsolete generic version. |
| src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs | Introduced a new constructor overload to allow skipping host fixture initialization and refactored host initialization logic. |
| src/Codebelt.Extensions.Xunit.Hosting/HostFixture.cs | Updated host configuration to set ApplicationName from the caller's assembly. |
| src/Codebelt.Extensions.Xunit.Hosting/GenericHostTest.cs | Updated constructors to use the new skipHostFixtureInitialization parameter. |
| src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTest.cs | Updated constructors to use the new skipHostFixtureInitialization parameter. |
| src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/AspNetCoreHostTest.cs | Updated constructors to use the new skipHostFixtureInitialization parameter. |
| CHANGELOG.md | Documented the new features, changes, and bug fixes for version 9.1.1. |
Files not reviewed (4)
- .nuget/Codebelt.Extensions.Xunit.App/PackageReleaseNotes.txt: Language not supported
- .nuget/Codebelt.Extensions.Xunit.Hosting.AspNetCore/PackageReleaseNotes.txt: Language not supported
- .nuget/Codebelt.Extensions.Xunit.Hosting/PackageReleaseNotes.txt: Language not supported
- .nuget/Codebelt.Extensions.Xunit/PackageReleaseNotes.txt: Language not supported
src/Codebelt.Extensions.Xunit.Hosting/XunitTestLoggerProvider.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
.nuget/Codebelt.Extensions.Xunit.Hosting/PackageReleaseNotes.txt (2)
5-5: Consider simplifying the wordingThe phrase "with respect to TFMs" could be simplified for better readability.
-CHANGED Dependencies to latest and greatest with respect to TFMs +CHANGED Dependencies to latest and greatest for TFMs🧰 Tools
🪛 LanguageTool
[style] ~5-~5: ‘with respect to’ might be wordy. Consider a shorter alternative.
Context: ...GED Dependencies to latest and greatest with respect to TFMs
Bug Fixes
- FIXED HostTest ...
(EN_WORDINESS_PREMIUM_WITH_RESPECT_TO)
8-9: Good backward compatibility fixesThe notes clearly explain the fixes applied to restore pre-9.1.0 behavior for both classes, ensuring backward compatibility.
Consider simplifying "prior to" to "before" in both lines for conciseness:
-FIXED HostTest class in the Codebelt.Extensions.Xunit.Hosting namespace to have same behavior as prior to 9.1.0 release (hereby being backward compatible as originally intended) -FIXED LoggerExtensions class in the Codebelt.Extensions.Xunit.Hosting namespace to have same behavior as prior to 9.1.0 release (hereby being backward compatible as originally intended) +FIXED HostTest class in the Codebelt.Extensions.Xunit.Hosting namespace to have same behavior as before 9.1.0 release (hereby being backward compatible as originally intended) +FIXED LoggerExtensions class in the Codebelt.Extensions.Xunit.Hosting namespace to have same behavior as before 9.1.0 release (hereby being backward compatible as originally intended)🧰 Tools
🪛 LanguageTool
[style] ~8-~8: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...ting namespace to have same behavior as prior to 9.1.0 release (hereby being backward co...(EN_WORDINESS_PREMIUM_PRIOR_TO)
[style] ~9-~9: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...ting namespace to have same behavior as prior to 9.1.0 release (hereby being backward co...(EN_WORDINESS_PREMIUM_PRIOR_TO)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (21)
.nuget/Codebelt.Extensions.Xunit.App/PackageReleaseNotes.txt(1 hunks).nuget/Codebelt.Extensions.Xunit.Hosting.AspNetCore/PackageReleaseNotes.txt(1 hunks).nuget/Codebelt.Extensions.Xunit.Hosting/PackageReleaseNotes.txt(1 hunks).nuget/Codebelt.Extensions.Xunit/PackageReleaseNotes.txt(1 hunks)CHANGELOG.md(1 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/AspNetCoreHostTest.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTest.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting/GenericHostTest.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting/HostFixture.cs(2 hunks)src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting/LoggerExtensions.cs(3 hunks)src/Codebelt.Extensions.Xunit.Hosting/XunitTestLogger.cs(2 hunks)src/Codebelt.Extensions.Xunit.Hosting/XunitTestLoggerProvider.cs(2 hunks)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/AspNetCoreHostTestTest.cs(0 hunks)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/Assets/ValidHostTest.cs(0 hunks)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MvcAspNetCoreHostTestTest.cs(0 hunks)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/WebHostTestFactoryTest.cs(1 hunks)test/Codebelt.Extensions.Xunit.Hosting.Tests/Assets/ValidHostTest.cs(0 hunks)test/Codebelt.Extensions.Xunit.Hosting.Tests/GenericHostTestFactoryTest.cs(1 hunks)test/Codebelt.Extensions.Xunit.Hosting.Tests/HostTestTest.cs(0 hunks)test/Codebelt.Extensions.Xunit.Hosting.Tests/ServiceCollectionExtensions.cs(2 hunks)
💤 Files with no reviewable changes (5)
- test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MvcAspNetCoreHostTestTest.cs
- test/Codebelt.Extensions.Xunit.Hosting.Tests/Assets/ValidHostTest.cs
- test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/Assets/ValidHostTest.cs
- test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/AspNetCoreHostTestTest.cs
- test/Codebelt.Extensions.Xunit.Hosting.Tests/HostTestTest.cs
🧰 Additional context used
🧬 Code Definitions (5)
src/Codebelt.Extensions.Xunit.Hosting/XunitTestLoggerProvider.cs (2)
src/Codebelt.Extensions.Xunit.Hosting/XunitTestLogger.cs (3)
XunitTestLogger(8-63)XunitTestLogger(14-18)XunitTestLogger(20-24)src/Codebelt.Extensions.Xunit.Hosting/LoggerExtensions.cs (2)
ITestStore(26-53)ITestStore(66-69)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTest.cs (3)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/ServiceCollectionExtensions.cs (1)
IServiceCollection(21-38)src/Codebelt.Extensions.Xunit.Hosting/ServiceCollectionExtensions.cs (3)
IServiceCollection(25-51)IServiceCollection(58-62)IServiceCollection(73-78)src/Codebelt.Extensions.Xunit.Hosting/GenericHostTest.cs (1)
InitializeHostFixture(28-40)
test/Codebelt.Extensions.Xunit.Hosting.Tests/GenericHostTestFactoryTest.cs (2)
test/Codebelt.Extensions.Xunit.Hosting.Tests/HostTestTest.cs (5)
Fact(27-34)Fact(36-43)Fact(45-52)Fact(54-58)Fact(60-64)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/WebHostTestFactoryTest.cs (4)
Fact(26-51)Fact(53-81)Fact(83-98)Fact(100-111)
src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs (3)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/AspNetCoreHostFixtureExtensions.cs (1)
HasValidState(18-22)src/Codebelt.Extensions.Xunit.Hosting/HostFixtureExtensions.cs (1)
HasValidState(18-24)src/Codebelt.Extensions.Xunit.Hosting/IHostFixture.cs (1)
ConfigureHost(36-36)
src/Codebelt.Extensions.Xunit.Hosting/GenericHostTest.cs (2)
src/Codebelt.Extensions.Xunit.Hosting/ServiceCollectionExtensions.cs (3)
IServiceCollection(25-51)IServiceCollection(58-62)IServiceCollection(73-78)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTest.cs (1)
InitializeHostFixture(33-47)
🪛 LanguageTool
.nuget/Codebelt.Extensions.Xunit/PackageReleaseNotes.txt
[style] ~5-~5: ‘with respect to’ might be wordy. Consider a shorter alternative.
Context: ...GED Dependencies to latest and greatest with respect to TFMs
Version 9.1.0
Availability: ....
(EN_WORDINESS_PREMIUM_WITH_RESPECT_TO)
.nuget/Codebelt.Extensions.Xunit.App/PackageReleaseNotes.txt
[uncategorized] ~5-~5: You might be missing the article “the” here.
Context: ... 8
ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
V...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
[style] ~5-~5: ‘with respect to’ might be wordy. Consider a shorter alternative.
Context: ...GED Dependencies to latest and greatest with respect to TFMs
Version 9.1.0
Availability: ....
(EN_WORDINESS_PREMIUM_WITH_RESPECT_TO)
CHANGELOG.md
[style] ~22-~22: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...ting namespace to have same behavior as prior to 9.1.0 release (hereby being backward ...
(EN_WORDINESS_PREMIUM_PRIOR_TO)
[style] ~23-~23: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...ting namespace to have same behavior as prior to 9.1.0 release (hereby being backward ...
(EN_WORDINESS_PREMIUM_PRIOR_TO)
[style] ~24-~24: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...Core namespace to have same behavior as prior to 9.1.0 release (hereby being backward co...
(EN_WORDINESS_PREMIUM_PRIOR_TO)
.nuget/Codebelt.Extensions.Xunit.Hosting/PackageReleaseNotes.txt
[style] ~5-~5: ‘with respect to’ might be wordy. Consider a shorter alternative.
Context: ...GED Dependencies to latest and greatest with respect to TFMs
Bug Fixes
- FIXED HostTest ...
(EN_WORDINESS_PREMIUM_WITH_RESPECT_TO)
[style] ~8-~8: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...ting namespace to have same behavior as prior to 9.1.0 release (hereby being backward co...
(EN_WORDINESS_PREMIUM_PRIOR_TO)
[style] ~9-~9: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...ting namespace to have same behavior as prior to 9.1.0 release (hereby being backward co...
(EN_WORDINESS_PREMIUM_PRIOR_TO)
.nuget/Codebelt.Extensions.Xunit.Hosting.AspNetCore/PackageReleaseNotes.txt
[style] ~5-~5: ‘with respect to’ might be wordy. Consider a shorter alternative.
Context: ...GED Dependencies to latest and greatest with respect to TFMs
Bug Fixes
- FIXED AspNetCor...
(EN_WORDINESS_PREMIUM_WITH_RESPECT_TO)
[style] ~8-~8: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...Core namespace to have same behavior as prior to 9.1.0 release (hereby being backward co...
(EN_WORDINESS_PREMIUM_PRIOR_TO)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: 🧪 Test (windows-2022, Release)
- GitHub Check: 🧪 Test (windows-2022, Debug)
🔇 Additional comments (38)
.nuget/Codebelt.Extensions.Xunit/PackageReleaseNotes.txt (1)
1-6: Version update looks good.The version increment from 9.1.0 to 9.1.1 with appropriate framework availability information and dependency update notes follows the established pattern in this file.
🧰 Tools
🪛 LanguageTool
[style] ~5-~5: ‘with respect to’ might be wordy. Consider a shorter alternative.
Context: ...GED Dependencies to latest and greatest with respect to TFMs
Version 9.1.0
Availability: ....(EN_WORDINESS_PREMIUM_WITH_RESPECT_TO)
CHANGELOG.md (3)
10-15: New feature documentation is clear and descriptive.The changelog entry properly documents the new feature - an overload of the
GetTestStoremethod that takes an optional category name parameter.
16-19: Change description is informative.The alignment of
IHostEnvironment.ApplicationNamebehavior betweenHostFixtureandAspNetCoreHostFixtureclasses is clearly documented, explaining that it will now use the assembly name of the calling Test type.
20-24: Bug fix documentation is thorough.The changelog properly documents backward compatibility fixes for
HostTest,LoggerExtensions, andAspNetCoreHostTestclasses to restore pre-9.1.0 behavior.🧰 Tools
🪛 LanguageTool
[style] ~22-~22: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...ting namespace to have same behavior as prior to9.1.0release (hereby being backward ...(EN_WORDINESS_PREMIUM_PRIOR_TO)
[style] ~23-~23: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...ting namespace to have same behavior as prior to9.1.0release (hereby being backward ...(EN_WORDINESS_PREMIUM_PRIOR_TO)
[style] ~24-~24: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...Core namespace to have same behavior as prior to 9.1.0 release (hereby being backward co...(EN_WORDINESS_PREMIUM_PRIOR_TO)
test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/WebHostTestFactoryTest.cs (1)
76-76: Updated method call to use new overload.The test has been updated to use the new overload of
GetTestStorethat accepts a category name parameter, passingnullto maintain the original behavior while adapting to the new API..nuget/Codebelt.Extensions.Xunit.App/PackageReleaseNotes.txt (1)
1-6: Version update is consistent.The version increment from 9.1.0 to 9.1.1 with framework availability information and dependency update notes maintains consistency with other package release notes in this PR.
🧰 Tools
🪛 LanguageTool
[uncategorized] ~5-~5: You might be missing the article “the” here.
Context: ... 8
ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
V...(AI_EN_LECTOR_MISSING_DETERMINER_THE)
[style] ~5-~5: ‘with respect to’ might be wordy. Consider a shorter alternative.
Context: ...GED Dependencies to latest and greatest with respect to TFMs
Version 9.1.0
Availability: ....(EN_WORDINESS_PREMIUM_WITH_RESPECT_TO)
src/Codebelt.Extensions.Xunit.Hosting/HostFixture.cs (2)
60-67: Improved host configuration with proper application nameThe addition of
ConfigureHostConfigurationsets the application name to match the caller's assembly name, aligning the behavior withAspNetCoreHostFixture. This ensures consistent behavior across host fixtures and provides proper application identification in logs and other contexts.
70-74: Properly formatted service provider configurationThe code maintains the same validation settings but with improved formatting, making it more readable.
.nuget/Codebelt.Extensions.Xunit.Hosting.AspNetCore/PackageReleaseNotes.txt (1)
1-9: Well-documented version update with clear bug fix descriptionThe release notes properly document the version update to 9.1.1 and clearly explain the bug fix for
AspNetCoreHostTestto maintain backward compatibility. This provides essential information for users upgrading from 9.1.0.🧰 Tools
🪛 LanguageTool
[style] ~5-~5: ‘with respect to’ might be wordy. Consider a shorter alternative.
Context: ...GED Dependencies to latest and greatest with respect to TFMs
Bug Fixes
- FIXED AspNetCor...
(EN_WORDINESS_PREMIUM_WITH_RESPECT_TO)
[style] ~8-~8: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...Core namespace to have same behavior as prior to 9.1.0 release (hereby being backward co...(EN_WORDINESS_PREMIUM_PRIOR_TO)
src/Codebelt.Extensions.Xunit.Hosting/XunitTestLogger.cs (2)
8-8: Enhanced logger with in-memory storage capabilitiesThe
XunitTestLoggernow inherits fromInMemoryTestStore<XunitTestLoggerEntry>, providing built-in storage for log entries. This change improves the logger's functionality by making it also serve as a test store, which aligns with the PR objectives.
35-35: Added local storage of log entriesThe logger now stores log entries locally in addition to sending them to the provider. This change enables direct access to log entries from the logger instance, improving testability.
src/Codebelt.Extensions.Xunit.Hosting/XunitTestLoggerProvider.cs (2)
10-10: Improved case-insensitive logger name handlingUsing
StringComparer.OrdinalIgnoreCasefor the loggers dictionary ensures that logger category names are compared in a case-insensitive manner, which is a good practice as category names shouldn't be case-sensitive.
36-36: Added direct access to specific loggers by category nameThe new indexer property allows direct access to a logger by its category name, which supports the enhanced functionality in
LoggerExtensions.GetTestStorethat now accepts an optionalcategoryNameparameter. This provides more granular access to log entries..nuget/Codebelt.Extensions.Xunit.Hosting/PackageReleaseNotes.txt (3)
1-2: Version update looks good!The version has been correctly incremented from 9.1.0 to 9.1.1 with proper formatting.
12-12: Good improvement to HostFixtureThe alignment of ApplicationName property with AspNetCoreHostFixture class ensures consistent behavior across the hosting implementations.
15-15: Well-documented new featureThe new GetTestStore overload with an optional categoryName parameter is clearly documented.
test/Codebelt.Extensions.Xunit.Hosting.Tests/GenericHostTestFactoryTest.cs (3)
7-11: Well-structured test classThe GenericHostTestFactoryTest class follows the proper inheritance pattern from Test base class and has a clean constructor implementation.
13-28: Good test for Create methodThe test correctly verifies that the caller type matches the test class type and that the application name is set to the assembly name of the test class. This is consistent with similar tests in WebHostTestFactoryTest.
31-51: Comprehensive test for CreateWithHostBuilderContextThis test thoroughly validates the functionality of the CreateWithHostBuilderContext method by:
- Ensuring context and its properties are not null
- Verifying services are not null
- Checking that ApplicationName is properly set to the assembly name
The test provides good coverage of the method's behavior.
test/Codebelt.Extensions.Xunit.Hosting.Tests/ServiceCollectionExtensions.cs (6)
18-18: Method name updated for clarityThe test method name has been improved to more accurately reflect the method being tested (AddXunitTestLogging).
25-31: Enhanced test coverage for GetTestStoreThe test now validates multiple scenarios for GetTestStore:
- Basic retrieval with default parameters
- Retrieval with explicit category name
- Retrieval with null category (all loggers)
This ensures comprehensive coverage of the new overload functionality.
32-40: Testing multiple loggersThe test has been enhanced to use two different loggers (logger1 and logger2) with distinct log messages. This provides better coverage by testing the logging functionality across different logger instances.
41-41: Good error handling testThe added test for KeyNotFoundException when using an invalid category name ensures robust error handling is in place.
43-53: Comprehensive logger store assertionsThe expanded assertions verify:
- Logger store equality for the same source
- Logger object validity
- Correct count of logged entries for each store
This provides thorough validation of the logger stores' behavior.
62-70: Complete verification of log entriesThe assertions thoroughly check all logged entries, including the new unique message from logger2, ensuring that the test store properly captures and maintains all log entries.
src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs (3)
25-30: Improved constructor with appropriate documentationThe original constructor has been updated to delegate to the new constructor with skipHostFixtureInitialization set to false by default. The XML documentation has been enhanced with exception information.
32-42: Well-documented new constructorThe new constructor has clear XML documentation that explains its purpose and parameters, including the exception condition when hostFixture is null.
45-56: Enhanced initialization flow with skip optionThe initialization logic has been improved to:
- Allow skipping initialization with the new parameter
- Check fixture state validity before proceeding
- Configure the host only when necessary
This enhancement reduces redundant initializations and improves flexibility, particularly in test scenarios where custom initialization is needed.
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/AspNetCoreHostTest.cs (2)
22-22: Implementation aligns with base class changes.The constructor now calls the new overloaded constructor with the
skipHostFixtureInitializationparameter set tofalse, preserving the original behavior while supporting the new initialization flow.
26-48: Good addition of the skipHostFixtureInitialization parameter.The new constructor provides flexibility by allowing tests to skip host fixture initialization when needed. The implementation correctly handles both initialization paths with clear early return logic when skipping is enabled. This change helps reduce code duplication in derived classes that need custom initialization flows.
src/Codebelt.Extensions.Xunit.Hosting/LoggerExtensions.cs (4)
18-18: Documentation update for new parameter.The added parameter description clearly explains the purpose of the
categoryNameparameter and its default behavior.
26-26: Enhanced method signature with optional parameter.The
GetTestStoremethod now accepts an optionalcategoryNameparameter, allowing for more targeted log retrieval while maintaining backward compatibility with existing code.
45-47: Improved filtering capability for test logs.The conditional return statement efficiently handles both cases - returning either all logs or just those for a specific category. This enhances the testing capabilities by allowing more precise verification of log messages.
68-68: Updated obsolete method to use new parameter.The obsolete
GetTestStore<T>method now correctly uses the new overload, passing the full type name as the category name to maintain consistent behavior.src/Codebelt.Extensions.Xunit.Hosting/GenericHostTest.cs (2)
14-14: Properly leverages the new base class parameter.The constructor now passes
trueto the base class constructor forskipHostFixtureInitialization, preventing duplicate initialization sinceGenericHostTestperforms its own initialization in theInitializeHostFixturemethod called on line 18.
21-21: Consistent initialization pattern across constructors.This constructor also correctly passes
trueto skip the base initialization, maintaining consistency with the other constructor and ensuring that initialization happens only once through the localInitializeHostFixturemethod.src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTest.cs (2)
17-17: Prevents duplicate initialization.The constructor now passes
trueto the base constructor to skip initialization at that level, sinceWebHostTesthas its own initialization logic in theInitializeHostFixturemethod called on line 22. This change ensures proper initialization flow.
25-25: Consistent initialization approach.Similar to the first constructor, this one correctly passes
trueto skip base initialization, maintaining a consistent pattern across all constructors in the class hierarchy and preventing redundant initialization.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #27 +/- ##
==========================================
+ Coverage 84.58% 91.17% +6.59%
==========================================
Files 32 32
Lines 668 714 +46
Branches 85 91 +6
==========================================
+ Hits 565 651 +86
+ Misses 100 58 -42
- Partials 3 5 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|



This pull request includes several updates and improvements across multiple files, focusing on version updates, bug fixes, new features, and enhancements to the hosting and logging functionalities.
Version Updates and Dependency Changes:
9.1.0to9.1.1in multiplePackageReleaseNotes.txtfiles. [1] [2] [3] [4]Bug Fixes:
AspNetCoreHostTestandHostTestclasses to ensure backward compatibility with behaviors prior to the9.1.0release. [1] [2] [3]New Features and Improvements:
LoggerExtensionsclass with a new overload ofGetTestStoremethod that takes an optionalcategoryNameargument. [1] [2] [3] [4]HostFixtureclass to alignIHostEnvironment.ApplicationNamewith the logic found inAspNetCoreHostFixtureclass. [1] [2]Code Refactoring:
AspNetCoreHostTestandHostTestclasses to support skipping host fixture initialization, reducing code duplication. [1] [2] [3]XunitTestLoggerto inherit fromInMemoryTestStore<XunitTestLoggerEntry>and added logging functionality directly to the test store. [1] [2]Documentation Updates:
CHANGELOG.mdto include details of the new features, changes, and bug fixes introduced in version9.1.1.Summary by CodeRabbit