-
Notifications
You must be signed in to change notification settings - Fork 1
V10.0.0/support for hostapplicationbuilder #30
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
WalkthroughThis commit includes modifications across hosting and test framework files. It updates the package version for System.Threading.Tasks.Extensions and refactors the hosting infrastructure by renaming ASP.NET Core fixtures to Web fixtures, removing obsolete types, and introducing a minimal hosting model. New classes, interfaces, extension methods, and factory methods streamline host configuration and testing, while adjustments to test files ensure consistency with the new structures. The changes also simplify exception handling, service resolution, and logging integration across the suite. Changes
Sequence Diagram(s)sequenceDiagram
participant T as Test/Factory
participant MHF as MinimalHostFixture
participant HBA as HostBuilderApplication
participant Host as IHost
T->>MHF: Invoke Create/ConfigureHost()
MHF->>HBA: Initialize host configuration
HBA-->>MHF: Return configured Application Builder
MHF->>Host: Build and run host
Host-->>T: Return running host instance
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (62)
💤 Files with no reviewable changes (6)
🪧 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.
Copilot reviewed 56 out of 57 changed files in this pull request and generated no comments.
Files not reviewed (1)
- Directory.Packages.props: Language not supported
Comments suppressed due to low confidence (2)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostFixture.cs:70
- Since the PR renames the property from 'HostingEnvironment' to 'Environment' in other parts of the code (e.g. when configuring the host), please ensure this change is applied consistently across all files to prevent potential confusion.
Environment = context.HostingEnvironment;
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/HttpClientExtensions.cs:21
- Confirm that all XML documentation references have been updated to reflect the new naming convention ('IWebHostFixture') consistently throughout the code.
/// <remarks>Designed to be used in conjunction with <see cref="WebHostTestFactory.RunAsync(System.Action{Microsoft.Extensions.DependencyInjection.IServiceCollection},System.Action{Microsoft.AspNetCore.Builder.IApplicationBuilder},System.Action{Microsoft.Extensions.Hosting.IHostBuilder},System.Func{System.Net.Http.HttpClient,System.Threading.Tasks.Task{System.Net.Http.HttpResponseMessage}},IWebHostFixture)"/> and <see cref="WebHostTestFactory.RunWithHostBuilderContextAsync(System.Action{Microsoft.Extensions.Hosting.HostBuilderContext,Microsoft.Extensions.DependencyInjection.IServiceCollection},System.Action{Microsoft.Extensions.Hosting.HostBuilderContext,Microsoft.AspNetCore.Builder.IApplicationBuilder},System.Action{Microsoft.Extensions.Hosting.IHostBuilder},System.Func{System.Net.Http.HttpClient,System.Threading.Tasks.Task{System.Net.Http.HttpResponseMessage}},IWebHostFixture)"/>.</remarks>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #30 +/- ##
==========================================
+ Coverage 91.17% 93.89% +2.71%
==========================================
Files 32 44 +12
Lines 714 884 +170
Branches 91 121 +30
==========================================
+ Hits 651 830 +179
+ Misses 58 44 -14
- Partials 5 10 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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: 2
🧹 Nitpick comments (25)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/Internal/MinimalWebHostTest.cs (1)
47-56: Add clarifying documentation forTweaker.Adjust.The usage of
Tweaker.Adjustfor bridging theHostBuilderContextis not immediately obvious. Adding a brief comment or docstring explaining why this step is needed can improve maintainability and clarity.src/Codebelt.Extensions.Xunit.Hosting/Internal/MinimalHostTest.cs (2)
14-19: Review disposal strategy for the created Host.If the host is not disposed, resources may persist beyond test execution, leading to potential memory or resource leaks in long test runs. Consider implementing a teardown or disposal pattern (e.g.,
IAsyncLifetime).
40-51: Document reasons for using the adjusted HostBuilderContext.As in the ASP.NET Core version, clarify the motivation for the transformation via
Tweaker.Adjust. This step may confuse new contributors without proper comments or docstrings.src/Codebelt.Extensions.Xunit.Hosting/MinimalHostTestFactory.cs (1)
15-16: Fix XML documentation to match actual parameter types.The parameter doc comments refer to
IHostBuilderinstead ofIHostApplicationBuilder. Align them to avoid misleading readers or automated documentation tools.-/// <param name="hostSetup">The <see cref="IHostBuilder"/> which may be configured.</param> +/// <param name="hostSetup">The <see cref="IHostApplicationBuilder"/> which may be configured.</param>Also applies to: 26-28
test/Codebelt.Extensions.Xunit.Hosting.Tests/MinimalHostTestFactoryTest.cs (1)
13-25: Good implementation, consider improving variable namingThe test correctly verifies that the caller type's declaring type matches the current test class and that the application name equals the assembly name. However, the variable names
sut1andsut2could be more descriptive for better readability.- Type sut1 = GetType(); - string sut2 = null; + Type callerType = GetType(); + string applicationName = null; var middleware = MinimalHostTestFactory.Create(Assert.NotNull, host => { - sut2 = host.Environment.ApplicationName; + applicationName = host.Environment.ApplicationName; }); - Assert.True(sut1 == middleware.CallerType.DeclaringType); - Assert.Equal(GetType().Assembly.GetName().Name, sut2); + Assert.True(callerType == middleware.CallerType.DeclaringType); + Assert.Equal(GetType().Assembly.GetName().Name, applicationName);test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MinimalMvcWebHostTestTest.cs (1)
35-42: Duplicate test methodThis test is identical to the previous one. Consider either removing the duplicate or modifying it to test a different aspect of the controller.
test/Codebelt.Extensions.Xunit.Hosting.Tests/GenericHostFixtureTest.cs (1)
27-27: Potential duplication in inline fixture creation.
Creating a freshGenericHostFixtureinline here replicates the_hostFixtureinstance already in use. If this test doesn't need a unique fixture, consider reusing the existing one to reduce overhead.- var invalidHostTest = new InvalidHostTest<GenericHostFixture>(new GenericHostFixture()); + var invalidHostTest = new InvalidHostTest<GenericHostFixture>(_hostFixture);src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/Internal/WebHostTest.cs (1)
8-8: Class naming could cause confusion.
WebHostTestinherits fromWebHostTest<IWebHostFixture>(a generic base). While valid, it might be unclear when reading code references which type is in use. Consider a more descriptive name to avoid overshadowing the generic base class.src/Codebelt.Extensions.Xunit.Hosting/MinimalHostTest.cs (2)
28-30: Clarify the purpose of the emptyConfigureHostmethod.
This virtual method is currently empty, which is fine if it’s meant purely for optional overrides. However, it would help maintainers to include a brief inline comment or XML documentation remark clarifying that this is a placeholder or extension point.
43-45: Fix misleading XML documentation reference toHostTest{T}.
The summary for your constructor says it initializes a new instance of<see cref="HostTest{T}" />, but the actual class name isMinimalHostTest<T>. Update the XML docs to prevent confusion.-/// Initializes a new instance of the <see cref="HostTest{T}" /> class. +/// Initializes a new instance of the <see cref="MinimalHostTest{T}" /> class.src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/MinimalWebHostFixture.cs (2)
39-43: Consider allowing configurable environment names.
Hardcoding"Development"is often useful for local testing. However, if other scenarios (e.g., staging, production-like tests) need coverage, a parameter or property for the environment name could be more flexible.var hb = WebApplication.CreateBuilder(new WebApplicationOptions() { - EnvironmentName = "Development", + EnvironmentName = EnvironmentName ?? "Development", ApplicationName = hostTest.CallerType.Assembly.GetName().Name });
56-59: Ensure proper disposal of the built application.
Leaving the application running or undisposed can create resource leaks (ports, background threads, etc.). Consider disposing ofwebApplicationor callingHost.Dispose()at an appropriate lifecycle point (e.g., post-test teardown), unless handled elsewhere.src/Codebelt.Extensions.Xunit.Hosting/HostFixture.cs (1)
16-22: Consider asynchronous start to prevent potential deadlocks
The_hostRunnerCallbackuses a blocking call tohost.StartAsync(). While referencing the linked workaround, consider an await-based approach to reduce potential deadlocks.- Task.Run(() => host.StartAsync().ConfigureAwait(false)) - .ConfigureAwait(false) - .GetAwaiter() - .GetResult(); + await host.StartAsync().ConfigureAwait(false);src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs (4)
11-11: Fix grammatical construction in the doc comment.Currently, the sentence in the
<summary>is somewhat unclear.Here's a proposed diff to improve readability:
-/// Represents the non-generic base class from its generic equivalent should derive. +/// Represents the non-generic base class from which its generic equivalent should derive.
27-36: Consider adding null checks for configuration and environment.While these are likely ensured by the fixture, it’s safer to guard against potential
nullreferences.For example:
public virtual void Configure(IConfiguration configuration, IHostEnvironment environment) { + if (configuration == null) throw new ArgumentNullException(nameof(configuration)); + if (environment == null) throw new ArgumentNullException(nameof(environment)); Configuration = configuration; Environment = environment; }
58-66: Documentation references an unusually complex design.The remark states the design is "rather complex," but it does not explain the specific constraints. Consider clarifying why xUnit's shared context requirement leads to this pattern.
84-84: Clarify parameter documentation for skip host fixture initialization.The doc comment simply states that it "indicates whether to skip the host fixture initialization," but readers may benefit from insight on when or why they'd skip it, e.g. advanced customization or environment setup.
test/Codebelt.Extensions.Xunit.Hosting.Tests/MinimalHostTestTest.cs (4)
23-29: Consider verifying host creation exceptions.In the constructor, a new service scope and
_correlationsFactoryare set up. IfhostFixture.HostorServicesfail to initialize, you may encounter runtime errors. An additional test to confirm a validHostobject (and no exceptions thrown) could bolster reliability.
31-38: Tests appear correct but rely on repeated "ScopedCorrelation" additions.Each test adds a
ScopedCorrelationtoScopedCorrelations. Evaluate whether these repeated additions are strictly necessary or if a shared test setup would suffice. Reducing repeated code can clarify the scope-lifetime assertions.
58-62: Ensure transient timing is not a factor in host startup.
Assert.True(_isHostRunning);is straightforward. If host startup is slow, theApplicationStartedcallback might not register quickly. In typical scenarios this is fine, but consider defensive checks if test environments vary significantly.
76-86: Add further checks for logging, disposal, or concurrency.The
Test_VerifyAbstractions()method checks the basic interface implementations. A complementary test verifying correct disposal or concurrency behavior (e.g., logging scopes across test runs) could add further confidence, especially in parallel test runs.src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/MinimalWebHostTestFactory.cs (2)
18-29: Initialize or validate the fixture consistently.Within
Create(...), a newMinimalWebHostFixtureis spawned by default, but if the passedhostFixturehas partial state, it might lead to inconsistent initialization downstream. Consider either fully re-initializing or throwing an exception if the fixture isn’t in a valid state.
59-72: Extend or overload the method to handle advanced request scenarios.
RunWithHostBuilderContextAsyncis helpful. If more advanced test scenarios (like configuring environment variables or multiple pipelines) are common, consider providing an overloaded method that allows for additional bundling or chaining of configurations.src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTest.cs (1)
50-60: Property documentation is succinct and consistent.
Consider adding a short note clarifying thatApplicationis valid only after the fixture has been initialized, to guide new contributors./// <summary> /// Gets the <see cref="IApplicationBuilder"/> initialized by the <see cref="IHost"/>. /// </summary> /// <value>The <see cref="IApplicationBuilder"/> initialized by the <see cref="IHost"/>.</value> +/// <remarks>Ensure that the host fixture is initialized before accessing <see cref="Application"/>.</remarks> public IApplicationBuilder Application { get; protected set; }src/Codebelt.Extensions.Xunit.Hosting/MinimalHostFixtureExtensions.cs (1)
13-16: Verify XML documentation accuracy regarding interface references.The documentation remarks on line 15 reference
IHostFixture.ConfigureCallbackandIHostFixture.Host, but the method extendsIMinimalHostFixture. While this might be correct ifIMinimalHostFixtureinherits fromIHostFixture, it would be clearer to reference the immediate interface when possible.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (57)
Directory.Packages.props(1 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/AspNetCoreHostFixtureExtensions.cs(0 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/BlockingAspNetCoreHostFixture.cs(0 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/BlockingWebHostFixture.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/HostBuilderApplicationExtensions.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/HttpClientExtensions.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/IMinimalWebHostFixture.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/IWebHostFixture.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/IWebHostTest.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/Internal/MinimalWebHostTest.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/Internal/WebHostTest.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/MinimalWebHostFixture.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/MinimalWebHostFixtureExtensions.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/MinimalWebHostTest.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/MinimalWebHostTestFactory.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostFixture.cs(3 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostFixtureExtensions.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTest.cs(2 hunks)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTestFactory.cs(5 hunks)src/Codebelt.Extensions.Xunit.Hosting/GenericHostFixture.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting/GenericHostFixtureExtensions.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting/GenericHostTestFactory.cs(0 hunks)src/Codebelt.Extensions.Xunit.Hosting/HostFixture.cs(3 hunks)src/Codebelt.Extensions.Xunit.Hosting/HostFixtureExtensions.cs(0 hunks)src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs(3 hunks)src/Codebelt.Extensions.Xunit.Hosting/HostTestFactory.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting/IEnvironmentTest.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting/IGenericHostFixture.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting/IGenericHostTest.cs(0 hunks)src/Codebelt.Extensions.Xunit.Hosting/IHostFixture.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting/IHostTest.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting/IMinimalHostFixture.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting/IServiceTest.cs(0 hunks)src/Codebelt.Extensions.Xunit.Hosting/Internal/HostTest.cs(3 hunks)src/Codebelt.Extensions.Xunit.Hosting/Internal/MinimalHostTest.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting/MinimalHostFixture.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting/MinimalHostFixtureExtensions.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting/MinimalHostTest.cs(1 hunks)src/Codebelt.Extensions.Xunit.Hosting/MinimalHostTestFactory.cs(1 hunks)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/Assets/InvalidHostTest.cs(1 hunks)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/Assets/ValidHostTest.cs(1 hunks)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MinimalMvcWebHostTestTest.cs(1 hunks)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MinimalWebHostTestFactoryTest.cs(1 hunks)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MinimalWebHostTestTest.cs(1 hunks)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MvcWebHostTestTest.cs(1 hunks)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/WebHostFixtureTest.cs(4 hunks)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/WebHostTestFactoryTest.cs(5 hunks)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/WebHostTestTest.cs(3 hunks)test/Codebelt.Extensions.Xunit.Hosting.Tests/Assets/InvalidHostTest.cs(1 hunks)test/Codebelt.Extensions.Xunit.Hosting.Tests/Assets/MinimalValidHostTest.cs(1 hunks)test/Codebelt.Extensions.Xunit.Hosting.Tests/Assets/ValidHostTest.cs(1 hunks)test/Codebelt.Extensions.Xunit.Hosting.Tests/GenericHostFixtureTest.cs(3 hunks)test/Codebelt.Extensions.Xunit.Hosting.Tests/HostTestFactoryTest.cs(4 hunks)test/Codebelt.Extensions.Xunit.Hosting.Tests/HostTestTest.cs(3 hunks)test/Codebelt.Extensions.Xunit.Hosting.Tests/MinimalHostFixtureTest.cs(1 hunks)test/Codebelt.Extensions.Xunit.Hosting.Tests/MinimalHostTestFactoryTest.cs(1 hunks)test/Codebelt.Extensions.Xunit.Hosting.Tests/MinimalHostTestTest.cs(1 hunks)
💤 Files with no reviewable changes (6)
- src/Codebelt.Extensions.Xunit.Hosting/IServiceTest.cs
- src/Codebelt.Extensions.Xunit.Hosting/HostFixtureExtensions.cs
- src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/BlockingAspNetCoreHostFixture.cs
- src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/AspNetCoreHostFixtureExtensions.cs
- src/Codebelt.Extensions.Xunit.Hosting/GenericHostTestFactory.cs
- src/Codebelt.Extensions.Xunit.Hosting/IGenericHostTest.cs
🧰 Additional context used
🧬 Code Definitions (29)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/BlockingWebHostFixture.cs (1)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostFixture.cs (2)
WebHostFixture(18-108)WebHostFixture(23-25)
test/Codebelt.Extensions.Xunit.Hosting.Tests/Assets/InvalidHostTest.cs (2)
test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/Assets/InvalidHostTest.cs (2)
InvalidHostTest(5-10)InvalidHostTest(7-9)src/Codebelt.Extensions.Xunit/Test.cs (2)
Test(14-157)Test(52-56)
src/Codebelt.Extensions.Xunit.Hosting/Internal/MinimalHostTest.cs (5)
src/Codebelt.Extensions.Xunit.Hosting/MinimalHostTest.cs (6)
MinimalHostTest(12-31)MinimalHostTest(19-21)MinimalHostTest(40-78)MinimalHostTest(51-53)MinimalHostTest(65-77)ConfigureHost(28-30)src/Codebelt.Extensions.Xunit.Hosting/MinimalHostFixtureExtensions.cs (1)
HasValidState(17-22)src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs (1)
Configure(32-36)src/Codebelt.Extensions.Xunit.Hosting/MinimalHostFixture.cs (1)
ConfigureHost(32-53)src/Codebelt.Extensions.Xunit.Hosting/IMinimalHostFixture.cs (1)
ConfigureHost(25-25)
test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/Assets/InvalidHostTest.cs (2)
test/Codebelt.Extensions.Xunit.Hosting.Tests/Assets/InvalidHostTest.cs (2)
InvalidHostTest(5-10)InvalidHostTest(7-9)src/Codebelt.Extensions.Xunit/Test.cs (2)
Test(14-157)Test(52-56)
src/Codebelt.Extensions.Xunit.Hosting/IGenericHostFixture.cs (2)
src/Codebelt.Extensions.Xunit.Hosting/GenericHostFixture.cs (1)
ConfigureHost(35-79)src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs (1)
ConfigureHost(109-111)
test/Codebelt.Extensions.Xunit.Hosting.Tests/Assets/ValidHostTest.cs (1)
src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs (5)
HostTest(16-55)HostTest(23-25)HostTest(65-118)HostTest(76-78)HostTest(90-103)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/Internal/MinimalWebHostTest.cs (4)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/MinimalWebHostTest.cs (4)
MinimalWebHostTest(17-66)MinimalWebHostTest(25-27)MinimalWebHostTest(39-53)ConfigureApplication(65-65)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/MinimalWebHostFixtureExtensions.cs (1)
HasValidState(18-22)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/MinimalWebHostFixture.cs (1)
ConfigureHost(34-62)src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs (1)
Configure(32-36)
src/Codebelt.Extensions.Xunit.Hosting/MinimalHostTestFactory.cs (2)
src/Codebelt.Extensions.Xunit.Hosting/Internal/MinimalHostTest.cs (3)
MinimalHostTest(7-52)MinimalHostTest(14-19)MinimalHostTest(21-26)src/Codebelt.Extensions.Xunit.Hosting/MinimalHostFixture.cs (2)
MinimalHostFixture(12-60)MinimalHostFixture(17-19)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/IWebHostTest.cs (1)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTestFactory.cs (2)
IWebHostTest(26-29)IWebHostTest(39-42)
src/Codebelt.Extensions.Xunit.Hosting/HostTestFactory.cs (1)
src/Codebelt.Extensions.Xunit.Hosting/Internal/HostTest.cs (3)
HostTest(7-57)HostTest(14-19)HostTest(21-26)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostFixture.cs (3)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/Internal/WebHostTest.cs (4)
ConfigureHost(59-63)WebHostTest(8-76)WebHostTest(17-23)WebHostTest(25-31)src/Codebelt.Extensions.Xunit.Hosting/HostFixture.cs (1)
HasTypes(37-50)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTest.cs (3)
WebHostTest(14-61)WebHostTest(22-24)WebHostTest(33-48)
test/Codebelt.Extensions.Xunit.Hosting.Tests/MinimalHostTestFactoryTest.cs (1)
src/Codebelt.Extensions.Xunit.Hosting/MinimalHostTestFactory.cs (1)
MinimalHostTestFactory(10-35)
test/Codebelt.Extensions.Xunit.Hosting.Tests/HostTestTest.cs (2)
src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs (5)
HostTest(16-55)HostTest(23-25)HostTest(65-118)HostTest(76-78)HostTest(90-103)src/Codebelt.Extensions.Xunit.Hosting/HostTestFactory.cs (1)
HostTestFactory(10-35)
test/Codebelt.Extensions.Xunit.Hosting.Tests/HostTestFactoryTest.cs (1)
src/Codebelt.Extensions.Xunit.Hosting/HostTestFactory.cs (1)
HostTestFactory(10-35)
test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MinimalWebHostTestFactoryTest.cs (4)
test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/WebHostFixtureTest.cs (4)
Fact(15-23)Fact(25-34)Fact(36-48)Fact(50-63)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/WebHostTestFactoryTest.cs (3)
Fact(26-51)Fact(53-81)Fact(83-98)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/MinimalWebHostTestFactory.cs (1)
MinimalWebHostTestFactory(16-73)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/Http/Features/FakeHttpResponseFeature.cs (1)
OnStarting(30-35)
test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/WebHostTestTest.cs (4)
src/Codebelt.Extensions.Xunit.Hosting/XunitTestLoggerProvider.cs (1)
ILogger(25-30)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/WebHostFixtureTest.cs (4)
Fact(15-23)Fact(25-34)Fact(36-48)Fact(50-63)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTestFactory.cs (1)
WebHostTestFactory(16-73)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MinimalWebHostTestTest.cs (1)
ConfigureApplication(160-164)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/Internal/WebHostTest.cs (4)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTest.cs (4)
WebHostTest(14-61)WebHostTest(22-24)WebHostTest(33-48)ConfigureApplication(60-60)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostFixtureExtensions.cs (1)
HasValidState(18-22)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostFixture.cs (1)
ConfigureHost(38-95)src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs (1)
Configure(32-36)
test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MinimalMvcWebHostTestTest.cs (3)
test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MvcWebHostTestTest.cs (3)
Fact(25-32)Fact(34-41)ConfigureApplication(52-56)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MinimalWebHostTestTest.cs (2)
ConfigureHost(143-158)ConfigureApplication(160-164)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/Assets/FakeController.cs (1)
FakeController(9-11)
src/Codebelt.Extensions.Xunit.Hosting/IMinimalHostFixture.cs (3)
src/Codebelt.Extensions.Xunit.Hosting/MinimalHostFixture.cs (1)
ConfigureHost(32-53)src/Codebelt.Extensions.Xunit.Hosting/MinimalHostTest.cs (1)
ConfigureHost(28-30)src/Codebelt.Extensions.Xunit.Hosting/Internal/MinimalHostTest.cs (1)
ConfigureHost(40-51)
test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MinimalWebHostTestTest.cs (6)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/ServiceCollectionExtensions.cs (1)
IHttpContextAccessor(40-43)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/Assets/BoolOptions.cs (1)
BoolOptions(5-18)src/Codebelt.Extensions.Xunit.Hosting/XunitTestLoggerProvider.cs (1)
ILogger(25-30)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTestFactory.cs (1)
WebHostTestFactory(16-73)test/Codebelt.Extensions.Xunit.Hosting.Tests/MinimalHostTestTest.cs (1)
ConfigureHost(93-98)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/Assets/ValidHostTest.cs (1)
ConfigureApplication(17-20)
src/Codebelt.Extensions.Xunit.Hosting/GenericHostFixture.cs (3)
src/Codebelt.Extensions.Xunit.Hosting/HostFixture.cs (3)
HostFixture(13-187)HostFixture(27-29)HasTypes(37-50)src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs (6)
ConfigureHost(109-111)HostTest(16-55)HostTest(23-25)HostTest(65-118)HostTest(76-78)HostTest(90-103)src/Codebelt.Extensions.Xunit.Hosting/IGenericHostFixture.cs (1)
ConfigureHost(30-30)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTest.cs (3)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/Internal/WebHostTest.cs (4)
WebHostTest(8-76)WebHostTest(17-23)WebHostTest(25-31)ConfigureApplication(48-57)src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs (6)
HostTest(16-55)HostTest(23-25)HostTest(65-118)HostTest(76-78)HostTest(90-103)Configure(32-36)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTestFactory.cs (2)
IWebHostTest(26-29)IWebHostTest(39-42)
src/Codebelt.Extensions.Xunit.Hosting/HostFixture.cs (4)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/HttpClientExtensions.cs (1)
Task(22-27)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTestFactory.cs (2)
Task(53-57)Task(68-72)src/Codebelt.Extensions.Xunit/Test.cs (2)
Task(148-151)Task(153-156)test/Codebelt.Extensions.Xunit.Tests/TestTest.cs (1)
Task(19-23)
src/Codebelt.Extensions.Xunit.Hosting/Internal/HostTest.cs (2)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/HostBuilderApplicationExtensions.cs (1)
IHostBuilder(20-24)src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs (1)
Configure(32-36)
test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/WebHostTestFactoryTest.cs (1)
src/Codebelt.Extensions.Xunit.Hosting/XunitTestLoggerProvider.cs (1)
ILogger(25-30)
test/Codebelt.Extensions.Xunit.Hosting.Tests/MinimalHostTestTest.cs (4)
test/Codebelt.Extensions.Xunit.Hosting.Tests/HostTestTest.cs (2)
TestCaseOrderer(15-99)OnDisposeManagedResources(88-91)src/Codebelt.Extensions.Xunit.Hosting/HostTestFactory.cs (1)
HostTestFactory(10-35)src/Codebelt.Extensions.Xunit.Hosting/XunitTestLogger.cs (1)
IDisposable(55-58)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MinimalWebHostTestTest.cs (1)
ConfigureHost(143-158)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/MinimalWebHostTestFactory.cs (3)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/MinimalWebHostTest.cs (3)
MinimalWebHostTest(17-66)MinimalWebHostTest(25-27)MinimalWebHostTest(39-53)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/Internal/MinimalWebHostTest.cs (3)
MinimalWebHostTest(8-71)MinimalWebHostTest(17-23)MinimalWebHostTest(25-31)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/MinimalWebHostFixture.cs (2)
MinimalWebHostFixture(14-75)MinimalWebHostFixture(19-21)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTestFactory.cs (3)
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTest.cs (3)
WebHostTest(14-61)WebHostTest(22-24)WebHostTest(33-48)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/Internal/WebHostTest.cs (3)
WebHostTest(8-76)WebHostTest(17-23)WebHostTest(25-31)src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostFixture.cs (2)
WebHostFixture(18-108)WebHostFixture(23-25)
test/Codebelt.Extensions.Xunit.Hosting.Tests/MinimalHostFixtureTest.cs (4)
test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/WebHostFixtureTest.cs (4)
Fact(15-23)Fact(25-34)Fact(36-48)Fact(50-63)test/Codebelt.Extensions.Xunit.Hosting.Tests/GenericHostFixtureTest.cs (3)
Fact(18-22)Fact(24-29)Fact(31-42)test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/Assets/InvalidHostTest.cs (2)
InvalidHostTest(5-10)InvalidHostTest(7-9)test/Codebelt.Extensions.Xunit.Hosting.Tests/Assets/MinimalValidHostTest.cs (2)
MinimalValidHostTest(7-12)MinimalValidHostTest(9-11)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: 🧪 Test (windows-2022, Debug)
- GitHub Check: 🧪 Test (ubuntu-22.04, Release)
- GitHub Check: 🧪 Test (ubuntu-22.04, Debug)
- GitHub Check: 🧪 Test (windows-2022, Release)
🔇 Additional comments (128)
test/Codebelt.Extensions.Xunit.Hosting.Tests/Assets/MinimalValidHostTest.cs (1)
1-13: Well-structured test implementation.This new test class provides a clean, minimal implementation of
MinimalHostTestwith appropriate constructor parameter passing. It follows good xUnit testing patterns and will serve well as a test asset.src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/IMinimalWebHostFixture.cs (1)
11-17: Well-designed interface with proper inheritanceThe interface is cleanly designed with appropriate inheritance from
IMinimalHostFixtureandIPipelineTest, following the Interface Segregation Principle. TheConfigureApplicationCallbackproperty clearly communicates its purpose for configuring the HTTP request pipeline in minimal style tests.src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/BlockingWebHostFixture.cs (1)
9-17: Good implementation of synchronous host executionThe
BlockingWebHostFixturecorrectly implements synchronous behavior by setting theHostRunnerCallbackto usehost.Run()instead of an asynchronous pattern. This effectively replaces the removedBlockingAspNetCoreHostFixtureclass mentioned in the PR objectives and maintains the same functionality for capturing exceptions during execution.src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostFixtureExtensions.cs (1)
18-22: Well-implemented validation with proper reuseThe extension method efficiently reuses validation logic by first calling
HasValidState()on the castedIGenericHostFixture, then adding web-specific checks forConfigureApplicationCallbackandApplication. This follows the DRY principle and creates a clean validation chain through the inheritance hierarchy.src/Codebelt.Extensions.Xunit.Hosting/GenericHostFixtureExtensions.cs (1)
17-22: Clear validation logic with readable formattingThe extension method properly checks all required properties for a valid
IGenericHostFixture:ConfigureServicesCallback,Host, andConfigureHostCallback. The formatting with logical AND operators on separate lines enhances readability and makes it easy to understand the validation criteria.src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/IWebHostFixture.cs (1)
9-10: Interface rename and inheritance update looks good.The renaming from
IAspNetCoreHostFixturetoIWebHostFixtureand changing the inheritance fromIHostFixturetoIGenericHostFixturealigns with the PR objectives. This change creates a more consistent naming scheme and better reflects the generalized web hosting capabilities.src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/MinimalWebHostFixtureExtensions.cs (2)
18-22: Well-implemented extension method for state validation.The
HasValidStateimplementation correctly builds upon the base validation fromIMinimalHostFixturewhile adding the necessary web-specific checks. This follows a clean pattern for extension methods.
13-17: Documentation is thorough and clear.The XML comments clearly explain what constitutes a valid state by listing all required non-null properties. The cross-references to the interfaces are correctly implemented.
test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/Assets/InvalidHostTest.cs (1)
5-5: Updated generic constraint is consistent with interface changes.The constraint change from
IHostFixturetoIGenericHostFixtureproperly aligns with the interface hierarchy updates in this PR.test/Codebelt.Extensions.Xunit.Hosting.Tests/Assets/InvalidHostTest.cs (1)
5-5: Updated generic constraint matches interface changes.Similar to the AspNetCore variant, this constraint update from
IHostFixturetoIGenericHostFixturecorrectly aligns with the interface renaming and hierarchy changes.src/Codebelt.Extensions.Xunit.Hosting/IHostTest.cs (2)
5-11: Good improvement to the interface definition and documentationThe updated documentation and interface hierarchy provide better clarity about the role of
IHostTest. The inheritance fromIConfigurationTest,IEnvironmentTest, andITestfollows the interface segregation principle well.
14-16: Documentation properly updated to reference IGenericHostFixtureThe property documentation correctly reflects the change from
IHostFixturetoIGenericHostFixture, maintaining consistency with the broader refactoring efforts in the PR.src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/HostBuilderApplicationExtensions.cs (1)
1-26:❓ Verification inconclusive
Well-structured extension method for IHostApplicationBuilder
This new extension method provides a clean way to convert an
IHostApplicationBuilderto anIHostBuilder, with proper exception handling and clear documentation. The implementation correctly checks if the builder is aWebApplicationBuilderbefore accessing itsHostproperty.However, it might be worth considering a more graceful fallback for non-WebApplicationBuilder implementations of IHostApplicationBuilder rather than throwing an exception.
🏁 Script executed:
#!/bin/bash # Check if there are other implementations of IHostApplicationBuilder in the codebase rg "class\s+\w+\s+:\s+(?:\w+,\s+)*IHostApplicationBuilder" --type csharpLength of output: 74
Potential Alternative Fallback Consideration for IHostApplicationBuilder Conversion
The extension method is well-structured with appropriate exception handling and documentation. It correctly checks for a WebApplicationBuilder before converting to an IHostBuilder. However, the concern about having a more graceful fallback for non-WebApplicationBuilder implementations remains.
Our preliminary repository search using the regular expression did not reveal any additional implementations of IHostApplicationBuilder. Given that the search result was inconclusive, please manually verify whether any other concrete implementations exist (or are likely to be introduced) that might benefit from a fallback strategy rather than triggering an exception.
test/Codebelt.Extensions.Xunit.Hosting.Tests/Assets/ValidHostTest.cs (1)
8-10: Class inheritance and constructor properly updatedThe class has been correctly updated to use
GenericHostFixtureinstead ofHostFixture, aligning with the refactoring changes in the PR. This maintains consistency with the framework changes.test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/Assets/ValidHostTest.cs (1)
6-8: Class inheritance and constructor properly updated for web hostingThe class has been correctly modified to use
WebHostTest<WebHostFixture>instead of the previous pattern, aligning with the interface and class renaming mentioned in the PR objectives. This maintains consistency with the broader changes in the package.src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/IWebHostTest.cs (1)
6-8: Interface inheritance change appears appropriate.The change from inheriting
IGenericHostTesttoIHostTestaligns with the PR objective of interface restructuring. This change harmonizes with the broader refactoring of renaming interfaces and classes throughout the codebase.src/Codebelt.Extensions.Xunit.Hosting/IGenericHostFixture.cs (1)
11-31: New interface provides clear extension points for host configuration.The
IGenericHostFixtureinterface appropriately extendsIHostFixtureto provide Microsoft DI integration capabilities. The callback properties and method signatures are well-documented and follow established patterns for configuration in .NET hosting.The
void ConfigureHost(Test hostTest)method expects a parameter that inherits fromHostTest<T>according to the documentation. This is validated in the implementation seen in the relevant code snippets fromGenericHostFixture.cs, which includes proper null and type checking.src/Codebelt.Extensions.Xunit.Hosting/IEnvironmentTest.cs (1)
6-14: Renaming enhances consistency and clarity.The renaming of the interface from
IHostingEnvironmentTesttoIEnvironmentTestand its property fromHostingEnvironmenttoEnvironmentimproves naming consistency while maintaining the same functionality. This change aligns with modern .NET naming conventions and the PR's objective of interface renaming.src/Codebelt.Extensions.Xunit.Hosting/IMinimalHostFixture.cs (1)
12-26: New minimal host fixture interface is well-structured.The
IMinimalHostFixtureinterface provides a streamlined approach for Microsoft DI integration in unit tests using the minimal hosting model. The documentation clearly indicates the purpose and usage of each member, and the interface design follows consistent patterns with other fixtures in the codebase.This addition aligns with the PR objective of introducing new fixtures, specifically the "minimal style implementation" mentioned in the PR summary. The use of
IHostApplicationBuilderreflects modern .NET 6+ approaches to application configuration.src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/Internal/MinimalWebHostTest.cs (3)
33-45: Ensure fixture initialization is thread-safe if shared across tests.If multiple tests share the same
IMinimalWebHostFixtureinstance concurrently, reassigning the callbacks inInitializeHostFixturemay cause data races or unexpected overrides. Confirm that each test has a unique fixture instance, or ensure thread safety.
58-70: Confirm usage ofAddFakeHttpContextAccessor.This suggests test-specific logic that might not suit production scenarios. Ensure that any test-only service registrations are segregated appropriately and do not leak into production code paths.
17-23:✅ Verification successful
Validate optional callbacks for null usage.
The constructor gracefully handles null callback parameters by using the
?operator for invocation. However, verify whether passingnullmight produce unexpected behavior or partial configuration.
🏁 Script executed:
#!/bin/bash # Grep lines where we rely on _pipelineConfigurator or _serviceConfigurator in this codebase without null checks rg "_pipelineConfigurator[^?]" -A 2 rg "_serviceConfigurator[^?]" -A 2Length of output: 11383
Optional Callback Null Handling Validated
After verifying the usage of the optional callback parameters across the codebase, we found that:
- The constructor safely resolves the
callerTypeusing null‐conditional operators.- All invocations (e.g., via
?.Invoke(...)) consistently guard against null values.There are no instances where these callbacks are directly invoked without null checking. However, please ensure that the design choice to allow partial configuration when callbacks are null is intentional and clearly documented.
src/Codebelt.Extensions.Xunit.Hosting/Internal/MinimalHostTest.cs (1)
28-38: Check concurrency behavior when reassigning fixture callbacks.Similar to the ASP.NET Core fixture, reassigning callbacks in
InitializeHostFixturecan cause race conditions if multiple tests share the same fixture. Confirm that test fixtures are unique per test or ensure synchronization.src/Codebelt.Extensions.Xunit.Hosting/MinimalHostTestFactory.cs (1)
21-33: Verify concurrency handling for host test creation.These static factory methods may be invoked repeatedly for multiple tests. Confirm whether creating shared
IMinimalHostFixtureinstances or reusing them across calls creates side effects.test/Codebelt.Extensions.Xunit.Hosting.Tests/MinimalHostTestFactoryTest.cs (1)
28-44: LGTM! Thorough host builder context verificationThis test effectively verifies that the host builder context properties are properly initialized and that the application name is set correctly to the assembly name. The assertions are comprehensive, checking all key properties.
test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/WebHostFixtureTest.cs (6)
9-9: LGTM! Class renamed for consistency with new naming conventionsThe class has been correctly renamed from
AspNetCoreHostFixtureTesttoWebHostFixtureTestto align with the broader refactoring of renaming interfaces and classes in the project.
11-11: LGTM! Constructor updated to match new class nameThe constructor has been updated to reflect the class name change.
19-19: LGTM! Fixture instance updated to use new class nameThe fixture instance has been updated to use the new
WebHostFixtureclass instead ofAspNetCoreHostFixture.
29-30: LGTM! Fixture and test instances updated to use new class namesBoth the fixture instance and the invalid host test have been updated to use the new
WebHostFixtureclass.
40-40: LGTM! Fixture instance updated to use new class nameThe fixture instance has been updated to use the new
WebHostFixtureclass.
54-54: LGTM! Fixture instance updated to use new class nameThe fixture instance has been updated to use the new
WebHostFixtureclass.src/Codebelt.Extensions.Xunit.Hosting/HostTestFactory.cs (1)
1-36: LGTM! Well-designed factory pattern implementationThis new
HostTestFactoryclass provides a clean and flexible API for creatingIHostTestinstances with various configuration options. The use of optional parameters allows for simple usage in basic scenarios while supporting more complex configurations when needed.The XML documentation is thorough and clearly explains the purpose of each method and parameter.
test/Codebelt.Extensions.Xunit.Hosting.Tests/MinimalHostFixtureTest.cs (6)
9-17: LGTM! Test class setup is clean and follows best practicesThe test class is well-structured with a private field for the fixture and proper initialization in the constructor. This approach ensures that each test has a fresh instance of the fixture.
18-22: LGTM! Proper null check testingThis test correctly verifies that the
ConfigureHostmethod throws anArgumentNullExceptionwhen passed a null argument, which is an important validation for API robustness.
24-29: LGTM! Type compatibility check implemented correctlyThis test verifies that the
ConfigureHostmethod throws anArgumentOutOfRangeExceptionwhen provided with an incompatible host test type, which is crucial for type safety.
31-42: LGTM! Successful host configuration verificationThis test ensures that the
ConfigureHostmethod correctly configures the host when provided with a valid host test, checking that all essential properties are properly initialized.
44-49: LGTM! Resource disposal testingThis test verifies that the
Disposemethod properly cleans up resources by checking theDisposedproperty, which is essential for classes implementingIDisposable.
51-56: LGTM! Async resource disposal testingThis test verifies that the
DisposeAsyncmethod properly cleans up resources asynchronously, which is essential for classes implementingIAsyncDisposable.src/Codebelt.Extensions.Xunit.Hosting/GenericHostFixture.cs (5)
8-15: Implementation follows good naming practices and inheritance hierarchy.The class is properly defined with clear naming and inheritance from
HostFixture, implementing theIGenericHostFixtureinterface. The class design and documentation are well-structured.
24-38: Parameter validation is thorough and well-documented.The method properly validates the
hostTestparameter with appropriate exceptions for null values and incorrect types. The documentation clearly specifies these validation rules.
40-64: Host configuration follows best practices.The
HostBuilderconfiguration is comprehensive, including content root, environment, application configuration with appropriate JSON files, environment variables, and host configuration. The approach aligns with standard practices for setting up test hosts.
66-72: Good use of conditional compilation for NET9_0_OR_GREATER.The service provider validation is conditionally compiled for NET9_0_OR_GREATER, ensuring compatibility across different .NET versions while enabling enhanced validation in newer versions.
81-91: Property declarations are clear and well-documented.The delegate properties for host and service configuration are properly defined with clear documentation explaining their purpose.
src/Codebelt.Extensions.Xunit.Hosting/MinimalHostFixture.cs (4)
6-12: Clear documentation explaining the relationship to GenericHostFixture.The remarks clearly indicate this is the "modern" minimal style implementation of
GenericHostFixture, which helps users understand the design philosophy and when to use each implementation.
32-36: Appropriate parameter validation.Similar to the
GenericHostFixture, this class properly validates thehostTestparameter with appropriate exceptions for null values and incorrect types.
37-41: Modern host configuration using HostApplicationBuilder.The implementation appropriately uses the newer
Host.CreateApplicationBuilder()pattern withHostApplicationBuilderSettings, which aligns with modern .NET hosting practices for minimal APIs.
55-59: Delegate property for modern host configuration.The delegate property type correctly uses
IHostApplicationBuilderinstead ofIHostBuilder, aligning with the modern minimal API approach.src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostFixture.cs (4)
13-18: Class renamed from AspNetCoreHostFixture to WebHostFixture.The renaming from ASP.NET Core-specific naming to more general Web naming is consistent with the PR objectives and aligns better with broader hosting models. The class now inherits from
GenericHostFixtureinstead of directly fromHostFixture.
30-41: Updated parameter validation for WebHostTest.The parameter validation in
ConfigureHosthas been updated to check forWebHostTest<>instead ofAspNetCoreHostTest<>, maintaining consistency with the class renaming throughout the codebase.
69-71: Variable renamed from HostingEnvironment to Environment.The variable has been renamed for consistency with the base class. This change aligns with the property naming in the
HostFixturebase class.
94-94: Method call changed to HostRunnerCallback.The direct call to a method has been replaced with a delegate callback pattern, which provides more flexibility and better separation of concerns.
test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MvcWebHostTestTest.cs (3)
13-13: Class renamed to align with the new fixture naming.The test class has been updated from
MvcAspNetCoreHostTestTesttoMvcWebHostTestTestto maintain consistency with the renamed fixture classes.
15-18: Updated field and constructor parameter types.The field and constructor parameter types have been updated from
AspNetCoreHostFixturetoWebHostFixtureto align with the renamed fixture classes.
20-20: Updated service resolution path.The service resolution has been updated to use
hostFixture.Host.Servicesinstead ofhostFixture.ServiceProvider, reflecting the structural changes in the fixture classes. This provides a more consistent service resolution pattern.test/Codebelt.Extensions.Xunit.Hosting.Tests/HostTestFactoryTest.cs (4)
7-7: Class renamed from GenericHostTestFactoryTest to HostTestFactoryTestThe class has been appropriately renamed to align with the PR objectives of renaming interfaces and classes. This change is consistent with the broader refactoring effort to update the hosting infrastructure.
9-9: Constructor name updated to match class nameThe constructor has been correctly updated to reflect the class name change, maintaining consistency.
18-24: Updated method call from GenericHostTestFactory to HostTestFactoryThe code has been properly refactored to use the new
HostTestFactory.Createmethod instead ofGenericHostTestFactory.Create. This change is consistent with the broader refactoring effort.
34-49: Updated method call to HostTestFactory.CreateWithHostBuilderContextThe code has been correctly refactored to use the new
HostTestFactory.CreateWithHostBuilderContextmethod. This maintains consistency with the new naming conventions in the hosting framework.test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MinimalWebHostTestFactoryTest.cs (6)
18-22: Well-structured class definition for MinimalWebHostTestFactoryTestThis new test class correctly extends the
Testbase class and implements a constructor with output helper injection, following the established pattern in the codebase.
24-40: Effective test for security exception handlingThis test properly verifies that a security exception is thrown when expected. The test is particularly valuable as it validates error handling when authorization policies are misconfigured.
42-58: Good test for caller type validationThis test appropriately verifies that the caller type's declaring type matches the test class type and that the application name correctly equals the assembly name. The use of
host.ToHostBuilder()demonstrates compatibility with the Host Builder pattern.
60-72: Async validation of application nameThis test correctly validates that the application name equals the assembly name in an asynchronous context using the RunAsync method. The test is well-structured and follows async best practices.
74-102: Comprehensive test for host builder context validationThis test thoroughly validates that all expected properties in the host builder context are properly initialized and that the application name is set correctly. The nested assertions provide comprehensive verification of the context's state.
104-135: Thorough test for server timing middleware integrationThis test effectively validates the integration with the server timing middleware, ensuring that timing information is correctly included in the response headers. The test demonstrates good use of middleware composition and asynchronous patterns.
test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MinimalMvcWebHostTestTest.cs (4)
14-24: Well-structured class definition with proper initializationThe class correctly inherits from
MinimalWebHostTest<MinimalWebHostFixture>and initializes the necessary components in the constructor. The test output helper is properly injected into the service provider, ensuring logging works correctly.
26-33: Effective test for HTTP GET requestThis test properly validates that a GET request to the "/Fake" endpoint returns a successful response with the expected content. The test follows best practices for asynchronous testing.
44-51: Proper host configurationThe override of
ConfigureHostcorrectly configures the host with the necessary services, including controllers and Xunit test logging. The method adds the appropriate application part to ensure theFakeControlleris discovered.
53-57: Correct application pipeline configurationThe override of
ConfigureApplicationproperly sets up the application pipeline with routing and endpoint mapping for controllers, which is essential for the HTTP requests in the tests to work correctly.test/Codebelt.Extensions.Xunit.Hosting.Tests/HostTestTest.cs (7)
8-8: Added import for Microsoft.Extensions.HostingThis import is necessary for accessing the
IHostApplicationLifetimewhich is used to track the host's running state.
16-16: Updated base class to use GenericHostFixtureThe class now correctly inherits from
HostTest<GenericHostFixture>rather thanHostTest<HostFixture>, aligning with the PR's renaming objectives.
18-18: Added field to track host running stateThe private boolean field
_isHostRunningis added to track the application's running state, which is used in a new test method.
23-29: Updated constructor and service scope initializationThe constructor parameter has been properly updated to accept a
GenericHostFixture. The service scope creation now useshostFixture.Host.Services.CreateScope()instead ofhostFixture.ServiceProvider.CreateScope(), and the code registers a callback to track when the application starts.
58-62: Added test to verify host is runningThis new test method ensures that the host is correctly started by checking the
_isHostRunningflag, which is set in the application started callback.
73-73: Updated environment name referenceThe code now correctly uses
Environment.EnvironmentNameinstead ofHostingEnvironment.EnvironmentName, aligning with the updated property names.
79-81: Updated factory method and interface verificationThe test now correctly uses
HostTestFactory.Create()instead ofGenericHostTestFactory.Create()and verifies assignment toIHostTestinstead of a previous interface, maintaining consistency with the renamed interfaces.test/Codebelt.Extensions.Xunit.Hosting.Tests/GenericHostFixtureTest.cs (3)
9-9: Good rename to clarify test responsibility.
Renaming the class toGenericHostFixtureTestreflects its focus on the newly introducedGenericHostFixture, enhancing clarity for future maintainers.
11-15: Constructor correctly instantiates the generic fixture.
Instantiating a dedicatedGenericHostFixturein the constructor ensures that each test has its own clean fixture instance, preventing unintended cross-test interference.
39-41: Environment and services assertions are correct.
Verifying_hostFixture.Host.Servicesand_hostFixture.Environmentensures that the host is properly configured and all services are accessible.src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/Internal/WebHostTest.cs (6)
17-23: Initialization pattern aligns with new callback model.
Passing callbacks and then callingInitializeHostFixtureonce is a clean approach, preventing partial initialization. This ensures a consistent host configuration.
25-31: Second constructor gracefully handles context-based configurators.
Allowing both parameter sets (with and withoutHostBuilderContext) improves flexibility. The code correctly defers to the same initialization routine.
33-46: Initialization logic ensures valid state before finalization.
By checkinghostFixture.HasValidState()and wiring up the callbacks only if necessary, you avoid repeated configuration. This is a well-structured approach.
48-57: Configuring the application pipeline dynamically.
Deferring the pipeline setup to_pipelineConfiguratoror_pipelineConfiguratorWithContextallows flexible middleware insertion. This design is test-friendly and extensible.
59-63: Host builder context creation is straightforward.
Building and storing aHostBuilderContextinsideConfigureHostis a clean pattern; it prevents accidental reuse of a stale context.
65-75: Encouraging test flexibility with service configurators.
The optional_serviceConfiguratorand_serviceConfiguratorWithContextfacilitate customizing registrations per test scenario, which is good practice.test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/WebHostTestTest.cs (6)
17-17: Renamed test class aligns with new hosting model.
Renaming toWebHostTestTestclarifies that it tests the newWebHostTest<T>implementation.
22-25: Constructor usage ofhostFixture.Host.Services.
Pulling services fromhostFixture.Host.Servicesis consistent with the fixture's new structure, ensuring all dependencies are properly configured.
38-38: Consistent logger retrieval.
RetrievingILogger<WebHostTestTest>from the pipeline'sApplicationServicesis correct; it aligns with the new fixture approach to application-level service resolution.
118-125: Logging message refined and validated in test.
“Hello stranger” logging replaces the previous message, and the assertion properly verifies the log entry. This preserves a robust test of the logging pipeline.
131-136: Ensuring new interfaces are covered correctly.
Expanding the interface checks toIHostTestandIEnvironmentTestaffirms that the new hosting abstractions remain validated by the test.
144-144: Supports more explicit logs during ConfigureApplication.
Explicitly logging fromConfigureApplicationhelps diagnose pipeline setup. This is beneficial for debugging complex middleware arrangements.src/Codebelt.Extensions.Xunit.Hosting/MinimalHostTest.cs (1)
66-69: Verify logic around skipping fixture initialization.
WhenskipHostFixtureInitializationis true, the constructor immediately returns, bypassingHasValidState()checks, host assignment, and final configuration steps. Confirm that callers setting this flag can safely handle Host and environment configuration themselves. Otherwise, partial or uninitialized state may cause test failures down the line.src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/MinimalWebHostTest.cs (1)
41-43: Validate the outcome of skipping host fixture initialization.
WhenskipHostFixtureInitializationistrue,HostandApplicationremain unset. Confirm that calling tests can handle this during test runs (e.g., using a different fixture or manual host setup). Otherwise, this may lead to NullReferenceExceptions.src/Codebelt.Extensions.Xunit.Hosting/IHostFixture.cs (3)
8-14: Good documentation clean-up
These doc comments effectively clarify the interface's scope for app and lifetime management. No issues found.
17-20: Property definition looks appropriate
ExposingIHostas a read-only property ensures immutability and matches the new fixture approach.
23-25: ConfigureCallback documentation alignment
The updated documentation consistently describes the delegate usage for environment and configuration.src/Codebelt.Extensions.Xunit.Hosting/HostFixture.cs (4)
10-13: Making the class abstract fosters extensibility
ConvertingHostFixtureto an abstract class clarifies its role as a base for specialized fixtures.
25-27: Constructor visibility
A protected constructor ensures only derived classes can instantiate this abstract fixture, which is consistent.
52-63: HostRunnerCallback property
The property ensures the delegate is never null, which is good. The approach is flexible but be mindful of concurrency if changing the callback after the fixture is in use.
88-88: Renamed environment property
UsingEnvironmentaligns with the interface naming conventions and enhances consistency.src/Codebelt.Extensions.Xunit.Hosting/Internal/HostTest.cs (4)
5-7: Refined internal sealed class
Renaming toHostTestwithIGenericHostFixtureclarifies the bridging between test logic and the generic host fixture.
14-21: Constructor overloads
Providing constructor overloads for bothAction<IServiceCollection>andAction<HostBuilderContext, IServiceCollection>fosters flexibility in test configuration.
28-38: InitializeHostFixture logic
Dynamically sets up the fixture callbacks only if the fixture is not already in a valid state. This approach aligns well with lazy initialization practices.
53-53: HostingEnvironment assignment
Assigninghbc.HostingEnvironment = Environmentensures the environment context remains consistent when configuring the host.src/Codebelt.Extensions.Xunit.Hosting/HostTest.cs (1)
102-102:✅ Verification successful
Ensure consistency of property initialization and usage.
Host = hostFixture.Host;is assigned here. Verify that this assignment is necessary in all scenarios and that using the fixture'sHostproperty is always valid, especially if initialization was partially skipped.You can run a quick search to confirm the usage of this property across derived classes and ensure no uninitialized references exist:
🏁 Script executed:
#!/bin/bash rg -A 5 $'Host\s*='Length of output: 6851
Final Verification: Consistency of 'Host' Property Usage Confirmed
After reviewing the usage across the codebase, the assignment
Host = hostFixture.Host;in
src/Codebelt.Extensions.Xunit.Hosting/HostTest.csis used consistently in all derived test classes. The search results confirm that all fixtures—whether for generic hosts, minimal hosts, or ASP.NET Core hosts—assign theHostproperty in the same way, and it is immediately followed by the configuration call. There is no evidence suggesting that partial initialization leads to uninitialized references.Action Items:
- Verify that any scenario involving partial initialization is handled elsewhere (e.g., via appropriate guards or callbacks), ensuring that
hostFixture.Hostis reliably initialized.- No further changes are required to the property assignment; the pattern is consistent and valid across the tests.
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/MinimalWebHostTestFactory.cs (1)
44-57:❓ Verification inconclusive
Handle potential client disposal or re-creation edge cases.
RunAsync(...)disposes of the client viausing var client = .... If the same fixture is reused multiple times in parallel, verify that concurrent calls don’t cause conflicts with the test server or misusedHttpClient.To verify concurrency usage across your test code:
🏁 Script executed:
#!/bin/bash rg -A 4 'MinimalWebHostTestFactory.RunAsync'Length of output: 1462
Concurrency Check: Fixture and HttpClient Disposal
The current implementation disposes the HttpClient at the end of eachRunAsync()call using ausingstatement. Our search in the tests indicates thatRunAsync()is invoked in a straightforward (seemingly sequential) fashion. If the same host fixture is intended to be reused in parallel, please verify that disposing the client won’t lead to conflicts with the test server or unexpected side effects when tests run concurrently. Consider confirming that:
- The host fixture isn’t shared across parallel tests—or if it is, that its lifecycle correctly isolates each test’s client instance.
- Concurrent calls (if supported) do not lead to race conditions or resource conflicts with the test server.
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTest.cs (3)
8-14: Documentation for class summary is well-structured.
No issues found. The commentary clearly communicates the class purpose and usage.
16-24: Constructor overload documented clearly.
The supplementary details for parameters are helpful. No concerns about missing logic or validations here.
26-48:❓ Verification inconclusive
Verify constructor parameter
skipHostFixtureInitializationusage.
While this constructor correctly handles skipping host fixture initialization, consider adding or reviewing any existing unit tests to ensure this behavior is tested.Run the following script to search for tests or calls providing
skipHostFixtureInitialization = true:
🏁 Script executed:
#!/bin/bash rg -A 5 $'WebHostTest\\s*\\(true' testLength of output: 37
Action Required: Verify Unit Test Coverage for Skipping Host Fixture Initialization
The current constructor implementation in
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTest.cs(lines 26–48) correctly handles the case whenskipHostFixtureInitializationis true. However, our search for tests instantiatingWebHostTestwith atruevalue for this parameter did not yield any results. Please verify that there are appropriate unit tests (or add them if missing) to ensure that skipping host fixture initialization is covered.
- File:
src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTest.cs(lines 26–48)- Recommendation: Manually verify if any tests exist that instantiate the class with
skipHostFixtureInitializationset to true. If such tests are absent, please add tests that validate:
- The early return when
skipHostFixtureInitializationis true.- That no host configuration logic is executed in this scenario.
test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/WebHostTestFactoryTest.cs (3)
50-50: Substitution of the old blocking fixture withBlockingWebHostFixture.
This aligns with the new naming conventions and fixture class. Confirm that no references to the oldBlockingAspNetCoreHostFixtureremain.
76-76: Logger store retrieval update.
Usingstartup.Host.Servicesfor retrieving the logger appears more direct and consistent with other code in the solution.
110-110: Trivial structural change.
The rest of the method body is unchanged. No additional feedback needed.test/Codebelt.Extensions.Xunit.Hosting.AspNetCore.Tests/MinimalWebHostTestTest.cs (8)
18-28: Class construction and initialization are clear.
The dependency injection setup for_providerand_pipelineensures easy reference in tests. This is straightforward and maintainable.
30-52: Test for middleware result is robust.
Verifies both initial body content and final boolean options. No logical or correctness issues noted.
54-64: Conditional test targeting .NET 9.0 or greater.
Using#if NET9_0_OR_GREATERis appropriate. However, if you need coverage on earlier frameworks, consider providing an alternative path or verifying acceptance of skipping this test in lower versions.
66-115: Thorough correlation token tests.
Scopes and request services are well-tested to confirm expected lifetimes. Implementation is clear and correct.
116-128: Logging test is straightforward.
Ensures that log messages can be properly captured and verified via the test store.
129-141: Interface conformance checks.
Validates host test object implements the correct abstractions, which is useful for regression testing.
143-159: Host configuration is well-defined.
The registration of correlation token services andBoolOptionsis consistent. No issues found.
160-164: Application configuration pipeline.
UsesBoolMiddlewareafter logging. The pipeline approach is concise and clear.src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/WebHostTestFactory.cs (6)
4-4: Good addition of the internal namespace importThis import is necessary for accessing the
WebHostTestclass in the internal namespace, which is used in the implementation of the factory methods.
24-24: Well-documented parameter additionThe documentation for the new
hostFixtureparameter clearly explains its purpose and default behavior, maintaining the quality of the API documentation.Also applies to: 37-37, 51-51, 66-66
26-26: Good API extension approachAdding an optional parameter maintains backward compatibility while providing more flexibility to consumers. This aligns well with the PR objective of renaming interfaces and enhancing customization options.
Also applies to: 39-39, 53-53, 68-68
28-28: Well-implemented null coalescing patternThe implementation correctly uses the provided
hostFixtureor falls back to creating a newWebHostFixturewhen none is provided, ensuring backward compatibility.Also applies to: 41-41
39-39: Method rename aligns with interface changesRenaming from what was likely
CreateWithContextAsynctoCreateWithHostBuilderContextmaintains consistency with the broader interface renaming changes in this PR.
24-68:✅ Verification successful
Verify usage patterns with the new parameter
The changes look good, but it would be beneficial to ensure that existing test code using these factory methods continues to work as expected with the interface and implementation changes.
🏁 Script executed:
#!/bin/bash # Find and analyze test files that might be using WebHostTestFactory echo "Searching for tests using WebHostTestFactory..." rg "WebHostTestFactory" --type csharp -l | grep -i "test" # Check if any tests are explicitly using the old IAspNetCoreHostFixture type echo -e "\nChecking for any references to the old interface name..." rg "IAspNetCoreHostFixture" --type csharpLength of output: 4203
All Usage Verified: New Parameter Integration is Sound
The updated methods that now accept an
IWebHostFixtureare working as expected. Our search confirmed that the test suite (including files such asWebHostTestFactoryTest.csandMinimalWebHostTestFactoryTest.cs) exercises these methods correctly. The only remaining reference to the oldIAspNetCoreHostFixtureappears inGlobalSuppressions.csas part of legacy suppression rules—this seems intentional to avoid a major version bump and does not affect runtime behavior.Directory.Packages.props (1)
14-14: Dependency version update looks good.The version update for
System.Threading.Tasks.Extensionsfrom 4.6.2 to 4.6.3 is a minor version increment that likely includes bug fixes and small improvements. This aligns with the broader updates in the PR.src/Codebelt.Extensions.Xunit.Hosting.AspNetCore/HttpClientExtensions.cs (1)
21-21: Documentation updated correctly to reflect interface renaming.The XML documentation has been properly updated to reference
IWebHostFixtureinstead of the previousIAspNetCoreHostFixture, maintaining consistency with the interface renaming strategy described in the PR objectives.src/Codebelt.Extensions.Xunit.Hosting/MinimalHostFixtureExtensions.cs (1)
1-24: Well-structured extension method for validating host fixture state.The implementation of
HasValidStatefollows good extension method practices and provides a useful validation mechanism forIMinimalHostFixtureinstances.
| internal sealed class MinimalWebHostTest : MinimalWebHostTest<IMinimalWebHostFixture> | ||
| { | ||
| private readonly Action<IApplicationBuilder> _pipelineConfigurator; | ||
| private readonly Action<IServiceCollection> _serviceConfigurator; | ||
| private readonly Action<HostBuilderContext, IApplicationBuilder> _pipelineConfiguratorWithContext; | ||
| private readonly Action<HostBuilderContext, IServiceCollection> _serviceConfiguratorWithContext; | ||
| private readonly Action<IHostApplicationBuilder> _hostConfigurator; |
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.
🛠️ Refactor suggestion
Clarify naming to avoid confusion.
Having both this class and its generic base class named MinimalWebHostTest can be confusing. Consider renaming one for clarity, for example:
• Keep the generic base class as MinimalWebHostTest<TFixture>
• Rename this sealed class to ConcreteMinimalWebHostTest or MinimalWebHostTestImpl.
| internal sealed class MinimalHostTest : MinimalHostTest<IMinimalHostFixture> | ||
| { | ||
| private readonly Action<IServiceCollection> _serviceConfigurator; | ||
| private readonly Action<HostBuilderContext, IServiceCollection> _serviceConfiguratorWithContext; | ||
| private readonly Action<IHostApplicationBuilder> _hostConfigurator; | ||
| private HostBuilderContext _hostBuilderContext; | ||
|
|
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.
🛠️ Refactor suggestion
Consider renaming for clarity.
Much like its ASP.NET Core counterpart, this class and its generic base class share the same identifier, potentially causing confusion. Evaluate a distinct class name (for instance, ConcreteMinimalHostTest) to promote readability.
|



This pull request includes several changes to the
Codebelt.Extensions.Xunit.Hosting.AspNetCorepackage, primarily focusing on renaming interfaces and classes, adding new extensions and fixtures, and updating package versions.Here are the most important changes:
Interface and Class Renaming:
IAspNetCoreHostFixturetoIWebHostFixtureand updated its implementation to align with the new naming convention.IWebHostTestto inherit fromIHostTestinstead ofIGenericHostTest.New Extensions and Fixtures:
BlockingWebHostFixtureclass to provide a synchronous implementation of theIWebHostFixtureinterface.HostBuilderApplicationExtensionsclass to provide extension methods forIHostApplicationBuilder.MinimalWebHostFixtureclass as a minimal style implementation ofWebHostFixture.MinimalWebHostFixtureExtensionsclass to provide extension methods forIMinimalWebHostFixture.Code Removal:
AspNetCoreHostFixtureExtensionsclass and its methods.BlockingAspNetCoreHostFixtureclass.Package Version Update:
System.Threading.Tasks.Extensionspackage version from4.6.2to4.6.3inDirectory.Packages.props.Minor Changes:
HttpClientExtensionsto reflect the newIWebHostFixtureinterface.These changes improve the structure and functionality of the
Codebelt.Extensions.Xunit.Hosting.AspNetCorepackage, making it more consistent and easier to use.Summary by CodeRabbit
New Features
HostTest,IGenericHostFixture,GenericHostFixture,MinimalHostFixture, andMinimalHostTestFactoryto enhance testing capabilities.Refactor
AspNetCoreHostFixturetoWebHostFixtureandIAspNetCoreHostFixturetoIWebHostFixture.Chores