FluentAssertions.Web icon indicating copy to clipboard operation
FluentAssertions.Web copied to clipboard

Add a MatchLocation and/or HaveLocation extension for redirect responses

Open adrianiftode opened this issue 4 years ago • 0 comments

Currently to check that redirect response that has the expected redirect location something like the following is tried:

response.Should().Be302Redirect()
                .And.HaveHeader("Location")
                .And.Match("/redirect-location");

What could ease would be:

to assert an exact match of the redirect header

response.Should().Be302Redirect()
                .And.HaveLocation("/redirect-location?id=231");

or to have a wild card match

response.Should().Be302Redirect()
                .And.MatchLocation("/redirect-location");

adrianiftode avatar Mar 30 '21 08:03 adrianiftode