Treating Null and Empty as the same #1863
-
Hello! I have a very similar problem as this discussion post. However, it's slightly different. I'm trying to test the mapping of a DTO to a real object using Is there a generalized solution for when any kind of List is empty for the subject.Should().BeEquivalentTo(expectation, opt => opt
.Using<List<IEnumerable>>(ctx =>
{
if (ctx.Subject is null or { Count: 0 } && ctx.Expectation is null or { Count: 0 })
{
return;
}
ctx.Subject.Should().BeEquivalentTo(ctx.Expectation);
})
.WhenTypeIs<List<IEnumerable>>()); Example of the errors that I got:
Thanks a lot! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Chaining |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
IEquivalencyStep
and pass it to theUsing
method of theoptions
argument.expectation