Skip to content

Add regression test for BindingContext.PropertyType (stacked on #8) - #9

Merged
guy-lud merged 1 commit into
fix/phase-1-correctness-bugsfrom
test/binding-context-property-type
Jul 12, 2026
Merged

Add regression test for BindingContext.PropertyType (stacked on #8)#9
guy-lud merged 1 commit into
fix/phase-1-correctness-bugsfrom
test/binding-context-property-type

Conversation

@guy-lud

@guy-lud guy-lud commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Stacked on top of #8. Adds the regression test for the B4 fix in that PR — BindingContext.PropertyType must expose each property's own type, not its declaring interface.

ℹ️ Base is fix/phase-1-correctness-bugs (the #8 branch) rather than master, because the test depends on the fix. GitHub auto-retargets this PR to master once #8 merges.

Tests added — Tests/.../SimpleSettings/BindingContextTests.cs

A custom ISectionBinder captures the BindingContext handed to it per property.

  • BindPropertySettings_ContextPropertyType_IsThePropertysOwnType — asserts context.PropertyType is string / int (the property types), not the interface. Fail-first verified: with the fix reverted to propertyInfo.DeclaringType, it reports ICaptureSettings instead of System.String.
  • BindPropertySettings_ContextStillExposesDeclaringInterface — documents that the fix did not remove access to the declaring type: it stays reachable via context.SettingsType and context.PropertyInfo.DeclaringType.

Verification

dotnet test from src/92 green on net8.0 + net10.0 (2 new methods × 2 TFMs on top of #8's 88).

Guards the B4 fix (PR #8): BindingContext.PropertyType must expose each
property's own type, not its declaring interface. Verified fail-first — with
PropertyType = propertyInfo.DeclaringType the assertion reports the property
type as the settings interface (ICaptureSettings) instead of System.String.

A second test documents that the fix did not remove access to the declaring
type: it stays reachable via SettingsType and PropertyInfo.DeclaringType.
@guy-lud
guy-lud merged commit b46428e into fix/phase-1-correctness-bugs Jul 12, 2026
@guy-lud
guy-lud deleted the test/binding-context-property-type branch July 12, 2026 16:44
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.

1 participant