Skip to content

Add test coverage for MaskedTextBox #10978

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

Merged
merged 5 commits into from
Mar 18, 2024

Conversation

MelonWang1
Copy link
Contributor

@MelonWang1 MelonWang1 commented Mar 1, 2024

Related #10453

Proposed changes

  • Add unit tests for MaskedTextBox to test its properties: BeepOnError, AsciiOnly and Culture

Customer Impact

  • None

Regression?

  • No

Risk

  • Minimal

Test methodology

  • Unit tests
Microsoft Reviewers: Open in CodeFlow

@MelonWang1 MelonWang1 requested a review from a team as a code owner March 1, 2024 09:40
Copy link

codecov bot commented Mar 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.20584%. Comparing base (bd97476) to head (c5922ee).
Report is 45 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #10978         +/-   ##
===================================================
+ Coverage   73.17333%   73.20584%   +0.03250%     
===================================================
  Files           3097        3097                 
  Lines         633955      634448        +493     
  Branches       47364       47380         +16     
===================================================
+ Hits          463886      464453        +567     
+ Misses        166522      166448         -74     
  Partials        3547        3547                 
Flag Coverage Δ
Debug 73.20584% <100.00000%> (+0.03250%) ⬆️
integration 18.44236% <ø> (-0.00840%) ⬇️
production 46.71475% <ø> (+0.04067%) ⬆️
test 94.97323% <100.00000%> (-0.00132%) ⬇️
unit 43.61802% <ø> (+0.07276%) ⬆️

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

@Tanya-Solyanik
Copy link
Member

@LeafShi1, @SimonZhao888 , @Epica3055 , @ricardobossan - please review this PR

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.

Maybe add tests for default values, to prevent unwanted changes in behavior. Like:

[WinFormsFact]
public void MaskedTextBox_DefaultValues()
{
    var control = new MaskedTextBox();

    Assert.False(control.AcceptsTab);
    Assert.True(control.AllowPromptAsInput);
    Assert.False(control.AsciiOnly);
    Assert.False(control.BeepOnError);
    Assert.False(control.CanUndo);
}

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.

We are moving towards adopting Fluent Assertions for tests. Take inspiration from these recent commits:

For a detailed guide, refer to the Fluent Assertions documentation here.

@ricardobossan ricardobossan added the waiting-author-feedback The team requires more information from the author label Mar 6, 2024
@dotnet-policy-service dotnet-policy-service bot removed the waiting-author-feedback The team requires more information from the author label Mar 7, 2024
@ricardobossan ricardobossan added the waiting-review This item is waiting on review by one or more members of team label Mar 7, 2024
@ricardobossan
Copy link
Member

LGTM

@SimonZhao888 SimonZhao888 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 8, 2024
@dotnet-policy-service dotnet-policy-service bot removed the waiting-author-feedback The team requires more information from the author label Mar 12, 2024
@lonitra lonitra added the ready-to-merge PRs that are ready to merge but worth notifying the internal team. label Mar 15, 2024
@lonitra lonitra merged commit 544df20 into dotnet:main Mar 18, 2024
8 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 9.0 Preview3 milestone Mar 18, 2024
@dotnet-policy-service dotnet-policy-service bot removed the ready-to-merge PRs that are ready to merge but worth notifying the internal team. label Mar 18, 2024
@MelonWang1 MelonWang1 deleted the Add_test_coverage_for_MaskedTextBox branch March 29, 2024 01:49
@github-actions github-actions bot locked and limited conversation to collaborators Apr 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants