NFluent.Web is an extension library to NFluent for web-related assertions.
With NFluent assertion libraries:
All you've got to remember is: Check.That
, cause every assertion is then provided via a super-duper-auto-completion-dot-experience ;-)
With NFluent.Web, you can write simple web assertions like this:
var request = (HttpWebRequest)WebRequest.Create("http://www.google.com");
request.UserAgent = "Mozilla/5.0 compatible";
request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip");
using (var response = (HttpWebResponse)request.GetResponse())
{
Check.That(response).StatusCodeEqualsTo(HttpStatusCode.OK)
.And.HasHeader(HttpResponseHeader.CacheControl)
.And.HasHeader("X-Frame-Options").Which.Contains("SAMEORIGIN")
.And.HasHeader(HttpResponseHeader.Server).Which.Contains("gws")
.And.IsGZipEncoded()
.And.Contains("Google");
// TODO: Allow usage of multiple assertions on a given header such as: .And.HasHeader("X-Frame-Options").Which.Contains("SAMEORIGIN").And.StartsWith("SAME").And.EndsWith("ORIGIN")
}
NFluent use cases are available here.
For any comment, remark or question on the library, please use the NFluent-Discuss google group.
Nfluent backlog is available as github issues
- If you want to join the project and contribute: Check this out first, but be our guest.
- If you don't want to contribute on the library, but you need a feature not yet implemented, don't hesitate to request it on the NFluent-Discuss google group. In any cases: you are welcome!