Skip to content

Add tests for CamelCaseStringEnumConverter case-insensitive deserialization#2069

Merged
ChrisPulman merged 2 commits intoFixFor2065_2067from
copilot/sub-pr-2068
Mar 25, 2026
Merged

Add tests for CamelCaseStringEnumConverter case-insensitive deserialization#2069
ChrisPulman merged 2 commits intoFixFor2065_2067from
copilot/sub-pr-2068

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 25, 2026

CamelCaseStringEnumConverter gained a namesToValuesIgnoreCase fallback map but had no tests exercising that path, leaving the case-insensitive behavior unverified.

Changes

  • Mixed-case theory testDeserializesEnumValuesWithVariousCasings covers inputs like vAlUeOnE, ValueOne, VALUEONE, and valueone, ensuring they all resolve via the case-insensitive path when no exact camelCase match exists.
  • Disambiguation test for case-different membersExactCaseMatchTakesPriorityOverCaseInsensitiveWhenMembersDifferByCase verifies that when an enum has members differing only by case (Alpha = 1, ALPHA = 2), the case-sensitive lookup takes priority and the correct member is returned for each serialized form ("alpha", "aLPHA", "Alpha", "ALPHA").
  • CaseDifferentMembers enum — helper enum added alongside CamelCaseEnum to support the disambiguation test.
enum CaseDifferentMembers
{
    Alpha = 1,
    ALPHA = 2,
}

// Exact camelCase form → case-sensitive hit
Deserialize<CaseDifferentMembers>("\"alpha\"")  // → Alpha
Deserialize<CaseDifferentMembers>("\"aLPHA\"")  // → ALPHA

// Field name form → case-sensitive hit (no fallback needed)
Deserialize<CaseDifferentMembers>("\"Alpha\"")  // → Alpha
Deserialize<CaseDifferentMembers>("\"ALPHA\"")  // → ALPHA

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…umConverter

Co-authored-by: ChrisPulman <4910015+ChrisPulman@users.noreply.github.com>
Agent-Logs-Url: https://github.com/reactiveui/refit/sessions/457806a0-8430-40b3-8e4e-26f6590217ff
Copy link
Copy Markdown
Author

Copilot AI commented Mar 25, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 0t3vsblobprodcus362.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/refit/refit/Refit.sln --packages /tmp/codeql-scratch-26cf538f58283729/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-26cf538f58283729/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-26cf538f58283729/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
    • Triggering command: /usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/refit/refit/Refit.Benchmarks/Refit.Benchmarks.csproj --packages /tmp/codeql-scratch-26cf538f58283729/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-26cf538f58283729/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-26cf538f58283729/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
  • 1s1vsblobprodcus386.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/refit/refit/Refit.Benchmarks/Refit.Benchmarks.csproj --packages /tmp/codeql-scratch-26cf538f58283729/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-26cf538f58283729/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-26cf538f58283729/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] [WIP] Address feedback on sync interface members & enum names support Add tests for CamelCaseStringEnumConverter case-insensitive deserialization Mar 25, 2026
Copilot AI requested a review from ChrisPulman March 25, 2026 16:30
@ChrisPulman ChrisPulman marked this pull request as ready for review March 25, 2026 16:59
@ChrisPulman ChrisPulman merged commit b08ffc2 into FixFor2065_2067 Mar 25, 2026
@ChrisPulman ChrisPulman deleted the copilot/sub-pr-2068 branch March 25, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants