FluentAssertions.Web
FluentAssertions.Web copied to clipboard
Configurable delegate to allow post-formatting the response
Use case:
Consider the following response:
Expected HTTP response to be "OK", but found InternalServerError.
The HTTP response was:
HTTP/1.1 500 InternalServerError
Set-Cookie: XSRF-TOKEN=aaaaaaaaaaaaaaaaaaaaaaa; path=/
Content-Type: application/json
Content-Length: 3963
{
"traceId": "traceba9919c5493c503a",
"message": "An error has occurred.",
"exceptionMessage": "Object reference not set to an instance of an object.",
"exceptionType": "NullReferenceException",
"stackTrace": " at SomeClass.SomeMethod() in C:\\dev\\Tracker.cs:line 111\r\n at SomeMethod() in C:\\dev\\workspace\\Someclasss.cs:line 43"
}
The originated HTTP request was:
The stacktrace property is not easily readable as it is formatted as a one-line string. Would be useful to intercept the response and replace "\r\n" with the actual new lines.
So an expected output would be
Expected HTTP response to be "OK", but found InternalServerError.
The HTTP response was:
HTTP/1.1 500 InternalServerError
Set-Cookie: XSRF-TOKEN=aaaaaaaaaaaaaaaaaaaaaaa; path=/
Content-Type: application/json
Content-Length: 3963
{
"traceId": "traceba9919c5493c503a",
"message": "An error has occurred.",
"exceptionMessage": "Object reference not set to an instance of an object.",
"exceptionType": "NullReferenceException",
"stackTrace": " at SomeClass.SomeMethod() in C:\\dev\\Tracker.cs:line 111
at SomeMethod() in C:\\dev\\workspace\\Someclasss.cs:line 43"
}
The originated HTTP request was:
And thus would ease reading the stack trace