Skip to content

feat: non-uniform custom comparer support across assertion types #4872

@thomhurst

Description

@thomhurst

Description

Custom comparer support varies significantly across assertion types:

  • CollectionContainsAssertion accepts IEqualityComparer<TItem>? in constructor
  • IsEquivalentToAssertion has .Using(Func<...>) method
  • DictionaryContainsKeyAssertion has both .Using(IEqualityComparer<TKey>) and .Using(Func<...>)
  • Some assertions accept comparer in constructor, others via fluent method

Suggested Fix

Standardize the API:

  1. Always use .Using() for fluent API (consistent method name)
  2. Document semantics clearly (does it replace or augment default comparer?)
  3. Support both IEqualityComparer<T> and Func<T, T, bool> overloads uniformly

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions