Skip to content

Conversation

@wahmedswl
Copy link
Contributor

fixes #78

@enisn enisn requested a review from Copilot July 12, 2025 08:50
@enisn
Copy link
Owner

enisn commented Jul 12, 2025

Thanks for you effort, I'll merge it after creating at least a test for this case

This comment was marked as outdated.

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.
@enisn enisn requested a review from Copilot July 12, 2025 08:59
Copy link
Contributor

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 PR adds a new attribute to perform case-insensitive equality comparisons on string fields and covers it with unit tests.

  • Implement ToLowerEqualsComparisonAttribute to generate ToLower().Equals(...) expressions.
  • Add BookFilter_LowerEquals and 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 BookFilterLowerEquals to match standard C# naming conventions.
public class BookFilter_LowerEquals : FilterBase

@enisn enisn merged commit bf55af1 into enisn:develop Jul 12, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow case-insensitive comparison for Equals as well just like Contains

2 participants