我有以下规范(使用 Machine.Specifications 或 mSpec):
public class when_a_user_logs_in_successfully
{
static Browser _browser;
static BrowserResponse _response;
Establish context = () =>
{
var bootstrapper = new ConfigurableBootstrapper();
_browser = new Browser(bootstrapper);
};
Because of = () => _response = _browser.Get("/Login", with => with.HttpRequest());
It should_return_a_successful_response = () => _response.Body.ShouldNotBeNull();
}
规范中的路线应该找到以下模块:
public class LoginModule : NancyModule
{
public LoginModule()
{
Get["/Login"] = parameters => "test";
}
}
但由于某种原因,响应的状态为“NotFound”,而 Body 则抛出异常,表示流已关闭/处置。我的规范解决方案引用了包含 LoginModule 的程序集。我还应该怎么做才能让规范在模块中找到路线?