Search code examples
c#fluent-assertions

Ignore case for object properties when comparing collections


I have two collections that contain objects of my custom type. I compare these collections using FluentAssertions library:

Collection1.Should().BeEquivalentTo(Collection2);

Let's say, objects in the collections have string property called Title, but sometimes their case is different (title case vs. upper case). The comparison fails due to this.

Is there a way to ignore case for some (or all) object's string properties when comparing collections?


Solution

  • No, sorry. But you could create your own implementation of IMemberSelectionRule