Skip to content

Pass actual exception to Assert.ThrowsException(Async) assertion error message builder #1655

@gao-artur

Description

@gao-artur

It would be helpful to get an actual exception when creating an assertion error message in the Assert.ThrowsException(Async)<T> methods.

var ex = await Assert.ThrowsExceptionAsync<ExpectedException>(
    () => DoAsync(),
    actualException =>
    {
        return actualException switch
        {
            RpcException rpc => $"{rpc.Message}, Trailers: {string.Join(", ", rpc.Trailers)}",
            _ => actualException.Message
        };
    });

AB#2332772

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions