Skip to content

Add unit tests for ParentControlDesigner #13173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

MelonWang1
Copy link
Contributor

@MelonWang1 MelonWang1 commented Mar 21, 2025

Related #10773

Proposed changes

  • Add unit test ParentControlDesignerTests.cs for public properties and method of the ParentControlDesigner.
Microsoft Reviewers: Open in CodeFlow

@MelonWang1 MelonWang1 requested a review from a team as a code owner March 21, 2025 08:37
Copy link

codecov bot commented Mar 21, 2025

Codecov Report

Attention: Patch coverage is 93.61702% with 9 lines in your changes missing coverage. Please review.

Project coverage is 61.87079%. Comparing base (4d44901) to head (ba4a5c8).
Report is 81 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #13173         +/-   ##
===================================================
+ Coverage   61.35261%   61.87079%   +0.51818%     
===================================================
  Files           1547        1553          +6     
  Lines         158479      159088        +609     
  Branches       14751       14816         +65     
===================================================
+ Hits           97231       98429       +1198     
+ Misses         60545       59943        -602     
- Partials         703         716         +13     
Flag Coverage Δ
Debug 61.87079% <93.61702%> (+0.51818%) ⬆️
integration 10.72448% <ø> (-0.00005%) ⬇️
production 39.89668% <ø> (+0.67483%) ⬆️
test 95.66556% <93.61702%> (-0.01391%) ⬇️
unit 37.34492% <ø> (+0.68645%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@MelonWang1 MelonWang1 added the waiting-review This item is waiting on review by one or more members of team label Mar 25, 2025
@ricardobossan ricardobossan requested a review from Copilot March 26, 2025 22:12
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds unit tests for ParentControlDesigner to validate its public properties and methods.

  • Introduces ParentControlDesignerTests.cs with tests for snap lines, control parenting, glyph retrieval, and component initialization.
  • Covers scenarios such as valid snap line collection, handling of null default values, and reparenting controls when applicable.
Comments suppressed due to low confidence (2)

src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ParentControlDesignerTests.cs:39

  • [nitpick] Consider caching the cast of snapLines to a List in a local variable to improve readability and avoid repeated casts in the assertions.
((List<SnapLine>)snapLines).Should()

src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/ParentControlDesignerTests.cs:144

  • [nitpick] Hiding the base method 'Contains' with 'new' might be confusing for future maintainers; consider overriding the method or renaming this implementation to clarify its intent.
public new bool Contains(Control ctl)

@ricardobossan ricardobossan added waiting-author-feedback The team requires more information from the author and removed waiting-review This item is waiting on review by one or more members of team labels Mar 26, 2025
Copy link
Member

@ricardobossan ricardobossan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

ricardobossan
ricardobossan previously approved these changes Apr 7, 2025
Copy link
Contributor

@Tanya-Solyanik Tanya-Solyanik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added one comment

@MelonWang1 MelonWang1 removed the waiting-author-feedback The team requires more information from the author label Apr 8, 2025
Copy link
Contributor

@Tanya-Solyanik Tanya-Solyanik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THank you!

@Tanya-Solyanik Tanya-Solyanik merged commit 01245f9 into dotnet:main Apr 8, 2025
8 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0 Preview4 milestone Apr 8, 2025
@MelonWang1 MelonWang1 deleted the Add_unit_tests_for_ParentControlDesigner branch April 9, 2025 01:13
@github-actions github-actions bot locked and limited conversation to collaborators May 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants