The LINQ extension method SelectMany yields duplicated messages when the LINQ query syntax is used as this test shows:
[Test]
public void Test()
{
Func<Result<string, string>> f = () =>
from a in Result<string, string>.FailWith("fail")
from b in Result<string, string>.Succeed("succeed")
from c in Result<string, string>.Succeed("succeed")
select a + b + c;
f().Match(
ifSuccess: (s, list) => Assert.Fail(),
ifFailure: list => Assert.That(list, Is.EquivalentTo(new[] { "fail" })));
}
The test fails with this message:
Expected: equivalent to < "fail" > But was: < "fail", "fail", "fail", "fail" >
The LINQ extension method
SelectMany
yields duplicated messages when the LINQ query syntax is used as this test shows:The test fails with this message: