Skip to content

Working with Redirects

Asserting on Expected Redirect Responses

Alba comes with some out of the box assertions to declaratively check expected redirects.

cs
public async Task asserting_redirects(IAlbaHost system)
{
    await system.Scenario(_ =>
    {
        // should redirect to the url
        _.RedirectShouldBe("/redirect");

        // should redirect permanently to the url
        _.RedirectPermanentShouldBe("/redirect");
    });
}

snippet source | anchor