JasperFx / alba

Easy integration testing for ASP.NET Core applications
https://jasperfx.github.io/alba
Apache License 2.0
407 stars 39 forks source link

headers: add .SingleValueShouldMatch(regex) assertion #51

Closed Pondidum closed 6 years ago

Pondidum commented 6 years ago

When testing an api, I am often returning the location header with a url which might not be guessable (e.g. /someresource/id/some-guid-here), so here is a pullrequest to add support for matching a header against a regex:

_.Header("location").SingleValueShouldMatch(new Regex(@"^/items/\d*$"));
// or
_.Header("location").SingleValueShouldMatch(@"^/items/\d*$");
jeremydmiller commented 6 years ago

@joemcbride @Pondidum I'm gonna interpret Joe's comment as "wake up Jeremy" ;) I'll try to get this bundled w/ whatever the aspnet core 2.1 fixes are soon