Skip to content

fix:Property set expression builder does not accept null values and lambdas - #239

Merged
ivo-stoilov merged 1 commit into
developfrom
stoilov/fix-property-expression-arrangement
May 29, 2025
Merged

fix:Property set expression builder does not accept null values and lambdas#239
ivo-stoilov merged 1 commit into
developfrom
stoilov/fix-property-expression-arrangement

Conversation

@ivo-stoilov

Copy link
Copy Markdown
Contributor

closes telerik/MATTeam#905

@ivo-stoilov
ivo-stoilov requested review from MariaDch and Copilot May 29, 2025 10:01

This comment was marked as outdated.

@ivo-stoilov
ivo-stoilov force-pushed the stoilov/fix-property-expression-arrangement branch from aa51de4 to 09df369 Compare May 29, 2025 10:20
@ivo-stoilov
ivo-stoilov force-pushed the stoilov/fix-property-expression-arrangement branch 3 times, most recently from 418df50 to b85506a Compare May 29, 2025 12:31
@ivo-stoilov
ivo-stoilov requested a review from Copilot May 29, 2025 12:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 enhances the property expression builder to accept null constants and lambda expressions for setting values, and updates related docs and error messaging.

  • Specify the target type in Expression.Constant to allow null values.
  • Introduce a Set(Expression<Func<T>>) overload for setting via lambda.
  • Refine error messages in ArrangeSet and improve XML documentation in interfaces and Expr utility.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
PropertyExpressionBuilder.cs Added typeof(T) to constant expression and new Set(Expression<Func<T>>) overload.
Mock.Arrange.cs Clarified ArrangeSet(Action) error text and updated usage examples.
IPropertyExpressionBuilder.cs Added overload and expanded XML docs for both Set methods and Get.
Expr.cs Switched to ArgumentException for invalid expressions and enriched XML documentation.
Comments suppressed due to low confidence (2)

Telerik.JustMock/PropertyExpressionBuilder.cs:46

  • Add unit tests for the new Set(Expression<Func<T>>) overload, including cases with null inputs and various lambda bodies, to validate its behavior.
public Expression<Action> Set(Expression<Func<T>> expression)

Telerik.JustMock/Mock.Arrange.cs:161

  • Update or add tests to assert the updated ArrangeSet error message and example formatting when OnDemand is enabled, preventing future regressions in output.
sb.AppendLine("ArrangeSet(Action) is not compatible with the OnDemand feature.");

Comment thread Telerik.JustMock/PropertyExpressionBuilder.cs
Comment thread Telerik.JustMock/IPropertyExpressionBuilder.cs Outdated
@ivo-stoilov
ivo-stoilov force-pushed the stoilov/fix-property-expression-arrangement branch from b85506a to b6d63d2 Compare May 29, 2025 12:49
@ivo-stoilov
ivo-stoilov merged commit a537548 into develop May 29, 2025
@ivo-stoilov
ivo-stoilov deleted the stoilov/fix-property-expression-arrangement branch May 29, 2025 13:30
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.

3 participants