From bf8107555d415bb5020f1adcbac215486bf915ce Mon Sep 17 00:00:00 2001 From: Your Date: Mon, 6 Jul 2026 20:42:19 +0200 Subject: [PATCH] =?UTF-8?q?test(tests):=20warning-zero=20follow-on=20#710?= =?UTF-8?q?=20=E2=80=94=20clear=203=20xUnit=20analyzer=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-on to the #710 nullable-cleanup (plan complete, 8 PR #727-734 merged). Dispatch `5czj9v` [2] SECONDAIRE. Clears the 3 residual xUnit-analyzer warnings in Tests/ (the nullable family hit 0 in #710; these are the remaining non-CS analyzer warnings the build emits). Fixes (3 distinct warnings, all additive annotation or async — no logic change): - HarvestManagerExpectedImageCountTests.cs L56 (xUnit1012): `string rsstyle` → `string? rsstyle`. The Theory has `[InlineData(10, 3, null, 10)]` (L52) deliberately passing null rsstyle to pin the "null rsstyle = no grouping" branch of ComputeExpectedImageCount (mirrors CardPen). The null is INTENTIONAL test input; `string?` is the honest param type. - LocalizedFileNameContractTests.cs L30 (xUnit1012): `string fileName` → `string? fileName`. The Theory has `[InlineData(null)]` (L28) pinning the GetLocalizedFileName guard clause (null/empty returned as-is). Same intentional-null-test-input idiom. - OwlAdapterRegressionTests.cs L306+L319 (xUnit1031): `public void` → `public async Task` + `adapter.ToFileAsync(...).Wait()` → `await adapter.ToFileAsync(...)`. xUnit1031 flags blocking Task.Wait() in test methods; the fix is the canonical async/await. The method tests OWL2XML serialization to a temp file (no sync-context → no deadlock risk either way); async is the clean fix the analyzer asks for. Test name unchanged (ToFileAsync_...). DoD (measured on this branch, base master 9ed2e789): - dotnet build Tests.csproj --no-incremental: xUnit warnings 3→0. 0 errors. - dotnet test --filter (HarvestManagerExpected|LocalizedFileName|OwlAdapterRegression): 41/41 pass. - dotnet test (full): 587 pass / 1 fail (OWL #133 permanent) / 5 skip (#719). 0 regression. Residual (irréductible-infra, hors-scope Tests/ DoD): MSB3073 ×1 distinct on the MAIN project (Argumentum.AssetConverter.csproj, not Tests) — the Microsoft.XmlSerializer.Generator PackageReference (L25) sgen target exits code 1 at build. This is a main-project build-infra warning, not a Tests/ code warning; the DoD scope is "dotnet build Tests → 0 warning (ou irréductible documenté)". It appears in the Tests build log only via the Tests→main project dependency. Suppressing it would require touching the main csproj (out of scope for this tests-only lane; main project is zero-CS-warning stable per #587 and the SGEN package may be load-bearing for ExtendedXmlSerializer). Follow-up: separate main-project investigation to decide suppress (`` off) vs document as irréductible-infra. Base 9ed2e789. 0 Cards/ write, 0 rendering code change. Dispatch 5czj9v [2] SECONDAIRE. Base 9ed2e789. Co-authored-by: Claude-Code --- .../Ontology/OwlAdapterRegressionTests.cs | 4 ++-- .../HarvestManagerExpectedImageCountTests.cs | 2 +- .../WebBasedGenerator/LocalizedFileNameContractTests.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Generation/Converters/Argumentum.AssetConverter.Tests/Ontology/OwlAdapterRegressionTests.cs b/Generation/Converters/Argumentum.AssetConverter.Tests/Ontology/OwlAdapterRegressionTests.cs index 78d734f4..a1a5d454 100644 --- a/Generation/Converters/Argumentum.AssetConverter.Tests/Ontology/OwlAdapterRegressionTests.cs +++ b/Generation/Converters/Argumentum.AssetConverter.Tests/Ontology/OwlAdapterRegressionTests.cs @@ -303,7 +303,7 @@ public void DocumentConcept_Unknown_Type_Throws() } [Fact] - public void ToFileAsync_Writes_A_Non_Empty_OWL2XML_File() + public async Task ToFileAsync_Writes_A_Non_Empty_OWL2XML_File() { // Serialization works end-to-end (this is why #133 ships a non-empty ontology despite // the readers being broken — the graph is correctly built, only self-retrieval fails). @@ -316,7 +316,7 @@ public void ToFileAsync_Writes_A_Non_Empty_OWL2XML_File() var tempPath = Path.Combine(Path.GetTempPath(), $"arg_onto_test_{Guid.NewGuid():N}.owl"); try { - adapter.ToFileAsync(OWLSharp.OWLEnums.OWLFormats.OWL2XML, tempPath).Wait(); + await adapter.ToFileAsync(OWLSharp.OWLEnums.OWLFormats.OWL2XML, tempPath); File.Exists(tempPath).Should().BeTrue(); var content = File.ReadAllText(tempPath); content.Should().NotBeNullOrEmpty("the serialized ontology must be non-empty"); diff --git a/Generation/Converters/Argumentum.AssetConverter.Tests/WebBasedGenerator/HarvestManagerExpectedImageCountTests.cs b/Generation/Converters/Argumentum.AssetConverter.Tests/WebBasedGenerator/HarvestManagerExpectedImageCountTests.cs index b0b44766..2a1671d9 100644 --- a/Generation/Converters/Argumentum.AssetConverter.Tests/WebBasedGenerator/HarvestManagerExpectedImageCountTests.cs +++ b/Generation/Converters/Argumentum.AssetConverter.Tests/WebBasedGenerator/HarvestManagerExpectedImageCountTests.cs @@ -54,7 +54,7 @@ public class HarvestManagerExpectedImageCountTests [InlineData(10, 3, "BUNCH", 10)] // case-sensitive: CardPen rsstyle is lowercase; "BUNCH" does NOT group [InlineData(10, 3, "Bunch", 10)] // case-sensitive: mixed-case does NOT group either public void ComputeExpectedImageCount_MirrorsCardPenGrouping( - int cardCount, int rscount, string rsstyle, int expected) + int cardCount, int rscount, string? rsstyle, int expected) { HarvestManager.ComputeExpectedImageCount(cardCount, rscount, rsstyle) .Should().Be(expected, diff --git a/Generation/Converters/Argumentum.AssetConverter.Tests/WebBasedGenerator/LocalizedFileNameContractTests.cs b/Generation/Converters/Argumentum.AssetConverter.Tests/WebBasedGenerator/LocalizedFileNameContractTests.cs index b6562545..5f1f15f7 100644 --- a/Generation/Converters/Argumentum.AssetConverter.Tests/WebBasedGenerator/LocalizedFileNameContractTests.cs +++ b/Generation/Converters/Argumentum.AssetConverter.Tests/WebBasedGenerator/LocalizedFileNameContractTests.cs @@ -27,7 +27,7 @@ public class LocalizedFileNameContractTests [Theory] [InlineData(null)] [InlineData("")] - public void EmptyOrNull_ReturnedAsIs(string fileName) + public void EmptyOrNull_ReturnedAsIs(string? fileName) { // The first guard returns the input verbatim, so no language substitution is attempted. CardSetLocalization.GetLocalizedFileName(fileName, "fr", "en")