var bootstrapper = new DefaultNancyBootstrapper(); var browser = new Browser(bootstrapper); var response = browser.Get("/", with => { with.HttpRequest(); }); Assert.Equal(HttpStatusCode.OK, response.StatusCode);
var bootstrapper = new DefaultNancyBootstrapper(); var browser = new Browser(bootstrapper); var response = browser.Get("/resource", with => { with.HttpRequest(); with.Query("id", "12345"); }); Assert.Equal(HttpStatusCode.OK, response.StatusCode);In this example, we use the Get() method to simulate an HTTP GET request to a resource with a query string parameter. We specify the query string parameter by calling the Query() method, which takes two arguments: the name of the parameter and its value. These examples use the Nancy.Testing package library.