Skip to content
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

Add coverage for DataSourceListEditor #13122

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Zheng-Li01
Copy link
Member

@Zheng-Li01 Zheng-Li01 commented Mar 12, 2025

Related #10773

Proposed changes

Add unit test DataSourceListEditorTests.cs for public method of the DataSourceListEditor.

Microsoft Reviewers: Open in CodeFlow

@Zheng-Li01 Zheng-Li01 requested a review from a team as a code owner March 12, 2025 09:39
@Zheng-Li01 Zheng-Li01 added the waiting-review This item is waiting on review by one or more members of team label Mar 12, 2025
Copy link

codecov bot commented Mar 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.45499%. Comparing base (df745d6) to head (77dbc30).
Report is 78 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #13122         +/-   ##
===================================================
+ Coverage   61.32538%   61.45499%   +0.12960%     
===================================================
  Files           1543        1548          +5     
  Lines         158339      158503        +164     
  Branches       14745       14751          +6     
===================================================
+ Hits           97102       97408        +306     
+ Misses         60539       60391        -148     
- Partials         698         704          +6     
Flag Coverage Δ
Debug 61.45499% <100.00000%> (-13.85836%) ⬇️
integration 10.72871% <ø> (-8.18178%) ⬇️
production 39.38064% <ø> (-35.93272%) ⬇️
test 95.68114% <100.00000%> (∅)
unit 36.81725% <ø> (-37.58343%) ⬇️

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.

@Tanya-Solyanik
Copy link
Member

Tanya-Solyanik commented Mar 12, 2025

  Test failed and will automatically retry. Failure details follow:

Expected type to be System.NotSupportedException, but found System.IO.MemoryStream.
at FluentAssertions.Execution.LateBoundTestFramework.Throw(String message)
at FluentAssertions.Execution.DefaultAssertionStrategy.HandleFailure(String message)
at FluentAssertions.Execution.AssertionChain.FailWith(Func1 getFailureReason) at FluentAssertions.Execution.AssertionChain.FailWith(Func1 getFailureReason)
at FluentAssertions.Execution.AssertionChain.FailWith(String message)
at FluentAssertions.Types.TypeAssertions.Be(Type expected, String because, Object[] becauseArgs)
at FluentAssertions.Primitives.ReferenceTypeAssertions2.BeOfType(Type expectedType, String because, Object[] becauseArgs) at FluentAssertions.Primitives.ReferenceTypeAssertions2.BeOfType[T](String because, Object[] becauseArgs)
at System.Windows.Forms.Tests.ClipboardTests.SetData_CustomFormat_Exception_BinaryFormatterDisabled_SerializesException() in /_/src/test/unit/System.Windows.Forms/System/Windows/Forms/ClipboardTests.cs:line 554
at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

@LeafShi1 LeafShi1 requested a review from Epica3055 March 18, 2025 02:47
@Olina-Zhang Olina-Zhang 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 19, 2025
@Zheng-Li01 Zheng-Li01 added waiting-review This item is waiting on review by one or more members of team and removed waiting-author-feedback The team requires more information from the author labels Mar 24, 2025
Copy link
Member

@Epica3055 Epica3055 left a comment

Choose a reason for hiding this comment

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

looks good 👍

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds unit tests for the DataSourceListEditor to improve coverage for its public methods.

  • Introduces tests for checking the resizable drop-down property.
  • Verifies EditValue behavior under various parameter scenarios.
  • Confirms that GetEditStyle returns the expected UI type.
Comments suppressed due to low confidence (1)

src/System.Windows.Forms.Design/tests/UnitTests/System/Windows/Forms/Design/DataSourceListEditorTests.cs:33

  • [nitpick] Consider also asserting the returned value from EditValue when valid inputs are provided, if the expected behavior can be predicted beyond ensuring no exception is thrown.
_dataSourceListEditor.EditValue(context: contextMock.Object, provider: providerMock.Object, value: null);
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.

Other than a small comment, all LGTM!

@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
@Zheng-Li01 Zheng-Li01 added waiting-review This item is waiting on review by one or more members of team and removed waiting-author-feedback The team requires more information from the author labels Mar 27, 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-review This item is waiting on review by one or more members of team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants