我正在使用NancyFX和FluentValidation,如https://github.com/NancyFx/Nancy/wiki/Nancy-and-Validation所述。我的web应用程序运行良好并验证可以正常使用,但是当我试图单元测试任何使用验证模块,我得到一个错误 Nancy.Validation.ModelValidationException : No model valid
实例注册我的实例ConfigureApplicationContainer: public class Bootstrapper : DefaultNancyBootstrapper
{
// The bootstrapper enables you to reconfigure the composition of the framework,
// by overridi
测试时,我有叫UserDto一个简单的对象,它看起来像: public class UserDto
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
我有一个南希控制器和简化的代码来创建一个用户,不给路径信息,因为这所有作品: public void Create