diff --git a/TUnit.Example.Asp.Net.TestProject/FactoryMethodOrderTests.cs b/TUnit.Example.Asp.Net.TestProject/FactoryMethodOrderTests.cs index 1c8540e9d7..b38605849c 100644 --- a/TUnit.Example.Asp.Net.TestProject/FactoryMethodOrderTests.cs +++ b/TUnit.Example.Asp.Net.TestProject/FactoryMethodOrderTests.cs @@ -4,9 +4,10 @@ namespace TUnit.Example.Asp.Net.TestProject; /// Tests verifying the execution order of WebApplicationFactory methods /// relative to WebApplicationTest hooks. /// -/// Factory methods run after SetupAsync but before test-specific configuration: -/// - Factory.ConfigureWebHost (order 3) -/// - Factory.ConfigureStartupConfiguration (order 4) +/// Factory methods are called when the shared factory is initialized. +/// Per-test web host builder configuration runs after SetupAsync but before +/// test-specific configuration: +/// - ConfigureWebHostBuilder (order 3) /// /// This allows: /// - Factory to provide base configuration shared across tests @@ -35,19 +36,18 @@ await Assert.That(GlobalFactory.ConfigureStartupConfigurationCallCount).IsGreate } [Test] - [DisplayName("Factory.ConfigureWebHost runs after SetupAsync")] - public async Task Factory_ConfigureWebHost_Runs_After_SetupAsync() + [DisplayName("ConfigureWebHostBuilder runs after SetupAsync")] + public async Task ConfigureWebHostBuilder_Runs_After_SetupAsync() { _ = Factory.CreateClient(); - // Note: Factory order tracking only works reliably when this test triggers factory initialization - // If factory was already initialized, these values are from a previous test's counter - if (FactoryConfigureWebHostCalledOrder > 0) - { - await Assert.That(FactoryConfigureWebHostCalledOrder) - .IsGreaterThan(SetupCalledOrder) - .Because("Factory methods run after SetupAsync (during factory access)"); - } + await Assert.That(GlobalFactory.ConfigureWebHostCallCount) + .IsGreaterThan(0) + .Because("ConfigureWebHost should be called when the shared factory is initialized"); + + await Assert.That(ConfigureWebHostBuilderCalledOrder) + .IsGreaterThan(SetupCalledOrder) + .Because("Per-test web host builder configuration runs after SetupAsync"); } [Test] diff --git a/docs/package.json b/docs/package.json index 4913f0fe79..890e2dc40e 100644 --- a/docs/package.json +++ b/docs/package.json @@ -58,6 +58,6 @@ "node-forge": "1.4.0", "picomatch": "4.0.4", "svgo": "4.0.1", - "yaml": "2.8.3" + "yaml": "2.8.4" } } diff --git a/docs/yarn.lock b/docs/yarn.lock index 678cf4efac..dba9af5334 100644 --- a/docs/yarn.lock +++ b/docs/yarn.lock @@ -9674,10 +9674,10 @@ yallist@^3.0.2: resolved "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== -yaml@2.8.3, yaml@^2.8.1: - version "2.8.3" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.8.3.tgz#a0d6bd2efb3dd03c59370223701834e60409bd7d" - integrity sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg== +yaml@2.8.4, yaml@^2.8.1: + version "2.8.4" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.8.4.tgz#4b5f411dd25f9544914d8673d4da7f29248e5e2e" + integrity sha512-ml/JPOj9fOQK8RNnWojA67GbZ0ApXAUlN2UQclwv2eVgTgn7O9gg9o7paZWKMp4g0H3nTLtS9LVzhkpOFIKzog== yocto-queue@^1.0.0: version "1.2.2"