Skip to content

Adds tests to ExpandAllGridItems and CollapseAllGridItems#14601

Closed
ricardobossan wants to merge 2 commits into
dotnet:mainfrom
ricardobossan:Issue_12055_Add_Code_Coverage_For_Collapse_Expand_All_Grid_Items
Closed

Adds tests to ExpandAllGridItems and CollapseAllGridItems#14601
ricardobossan wants to merge 2 commits into
dotnet:mainfrom
ricardobossan:Issue_12055_Add_Code_Coverage_For_Collapse_Expand_All_Grid_Items

Conversation

@ricardobossan

@ricardobossan ricardobossan commented Jun 2, 2026

Copy link
Copy Markdown
Member

Related to #12055

Root Cause

  • Not a bug. PropertyGrid.ExpandAllGridItems and PropertyGrid.CollapseAllGridItems had no unit test coverage, contributing to the PropertyGrid's overall coverage gap (~49.91%).

Proposed changes

  • Add two unit tests to PropertyGridTests.cs:
    • PropertyGrid_ExpandAllGridItems_ExpandsNestedGridItems
    • PropertyGrid_CollapseAllGridItems_CollapsesNestedGridItems
  • Both reuse the existing MyClass fixture (it already exposes an [ExpandableObjectConverter] nested property), set it as SelectedObject, then assert the nested entry's Expanded state flips as expected.
  • Add a small FindExpandableProperty test helper that walks to the root grid item and returns the first expandable property entry.

Customer Impact

  • None

Regression?

  • No

Risk

  • Minimal

Test methodology

  • Unit tests

Test environment(s)

  • 11.0.100-preview.5.26227.104
Microsoft Reviewers: Open in CodeFlow

- Not a bug. `PropertyGrid.ExpandAllGridItems` and `PropertyGrid.CollapseAllGridItems` had no unit test coverage, contributing to the PropertyGrid's overall coverage gap (~49.91%).

- Add two unit tests to `PropertyGridTests.cs`:
  - `PropertyGrid_ExpandAllGridItems_ExpandsNestedGridItems`
  - `PropertyGrid_CollapseAllGridItems_CollapsesNestedGridItems`
- Both reuse the existing `MyClass` fixture (it already exposes an `[ExpandableObjectConverter]` nested property), set it as `SelectedObject`, then assert the nested entry's `Expanded` state flips as expected.
- Add a small `FindExpandableProperty` test helper that walks to the root grid item and returns the first expandable property entry.

- None

- No

- Minimal

- Unit tests

- 11.0.100-preview.5.26227.104
@SimonZhao888

Copy link
Copy Markdown
Member

Please fix the failed test cases first.

@ricardobossan ricardobossan force-pushed the Issue_12055_Add_Code_Coverage_For_Collapse_Expand_All_Grid_Items branch from 27f3d38 to 6b826ca Compare June 6, 2026 18:23
@ricardobossan ricardobossan requested a review from LeafShi1 June 6, 2026 18:24
@ricardobossan

Copy link
Copy Markdown
Member Author

Closing due to #12055 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants