I got two objects with the same data, double, long, string my problem is in object A all strings are upper case and in object B upper and lower.
objectA.Should.Should().BeEquivalentTo(objectB);
The comparison fails saying
Expected member stringName to be "Super" but "SUPER" differs near "UPER"
Is there any way to say if the we compare string ignore that it is all capital or convert an all capital string?
I could run a foreach loop go through everything and convert but I wonder if I can include my comparison to my fluent assert.
You can do something like:
objectA.Should.Should().BeEquivalentTo(objectB,
opt => opt.Using<string>(ctx => ctx.Subject.Should().BeEquivalentTo(ctx.Expectation)).WhenTypeIs<string>());
The confusing part is that there's a BeEquivalentTo on string that does a case-insensitive comparison, and it has nothing to do with the outer BeEquivalentTo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With