Allow case-insensitive comparison for Equals as well just like Contains#79
Merged
Conversation
Owner
|
Thanks for you effort, I'll merge it after creating at least a test for this case |
Introduces unit tests for the ToLowerEqualsComparisonAttribute, covering case insensitivity, empty and null values, special and unicode characters, whitespace, no matches, and exact match scenarios for the Book.Title property.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new attribute to perform case-insensitive equality comparisons on string fields and covers it with unit tests.
- Implement
ToLowerEqualsComparisonAttributeto generateToLower().Equals(...)expressions. - Add
BookFilter_LowerEqualsand extensive tests for various string matching scenarios. - Ensure filters behave correctly for nulls, empty strings, whitespace, special and Unicode characters.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/AutoFilterer.Tests/Attributes/ToLowerEqualsComparisonAttributeTests.cs | New tests for case-insensitive equals scenarios across multiple edge cases. |
| src/AutoFilterer/Attributes/ToLowerEqualsComparisonAttribute.cs | Attribute implementation that builds the expression tree for the equals comparison. |
Comments suppressed due to low confidence (2)
tests/AutoFilterer.Tests/Attributes/ToLowerEqualsComparisonAttributeTests.cs:117
- [nitpick] The test name suggests trimming whitespace, but the implementation only compares the raw strings. Either rename the test to clarify it’s exact-match with whitespace or add Trim() in the attribute to actually handle leading/trailing spaces.
public void BuildExpression_ShouldHandleWhitespace(List<Book> dummyData)
tests/AutoFilterer.Tests/Attributes/ToLowerEqualsComparisonAttributeTests.cs:204
- [nitpick] The filter class name uses an underscore in PascalCase; consider renaming to
BookFilterLowerEqualsto match standard C# naming conventions.
public class BookFilter_LowerEquals : FilterBase
enisn
approved these changes
Jul 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #78