Skip to content

Automatic extraction of aggregate exceptions makes it harder for me to test #696

@chrischu

Description

@chrischu

I want to test a method that is synchronous but calls an asynchronous method and I want to ensure that I use AsyncMethod().WaitAndUnwrapExceptions() instead of AsyncMethod.Result, however this is currently not easily testable since FluentAssertions automatically unwraps the exception.

This is in my opinion a pretty bad idea as it might lead to a false feeling of security when in reality it might cover up a bug, because in reality no one unwraps the exception if I use .Result and then I have to catch AggregateException instead of the contained exceptions.

Therefore I think it would be best to completely remove the automatic exception unwrapping from assertions. However, if that is not desired for backwards compatibility I would at least like an option to disable the unwrapping in my solution (similiarly to how I can configure how ShouldBeEquivalentTo works).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions