NancyFx单元测试如何通过测试浏览器传递浏览器路由参数?

The*_*Cat 4 unit-testing nancy

我试图通过Nancy.Testing.Browser对象传递路由参数(而不是查询参数!).我理解(现在)如何向/从我的NancyModule发送和使用查询字符串:

var customerResponse = browser.Get("/customer/id", with =>
{
    with.HttpRequest();
    with.Query("{id}", alansIdGuid.ToString());
});
Run Code Online (Sandbox Code Playgroud)

...

Get["/customer/{id}"] = parameters =>
{
    string idFromQuery = Request.Query.id;
    Customer customerFromId = _customerRepo.GetCustomerById(idFromQuery);
    return Response.AsJson<Customer>(customerFromId);
};
Run Code Online (Sandbox Code Playgroud)

但是 - 我想要做的是点击我的路线并检索我的路线参数,如下所示:

Get["/customer/{id}"] = parameters =>
{
    string id = parameters.id;
    Customer customerFromId = _customerRepo.GetCustomerById(id);
    return Response.AsJson<Customer>(customerFromId);
};  
Run Code Online (Sandbox Code Playgroud)

如何使用Nancy.Testing.Browser将我的Id参数作为路由参数传递?

- 没有使用标题,Cookie或查询字符串?

这是一个3小时的搜索看似简单的任务!以下问题围绕这个问题展开,但不解决它:

从测试发送参数到Nancy模块

NancyFX:带有查询字符串参数的路由始终返回404 NotFound

为什么没有查询参数传递给我的NancyFX模块?

The*_*Cat 5

我是个白痴...我猜答案对其他人来说似乎很明显!

var customerResponse = browser.Get("/customer/" + alansIdGuid.ToString(), with =>
{             
    with.HttpRequest();
});
Run Code Online (Sandbox Code Playgroud)

只需将查询字符串/值附加到您正在使用的Nancy.Testing.Browser对象的请求URL的末尾.