c# - 在南希测试自定义 Bootstrap

标签 c# testing mstest bootstrapper nancy

所以我有一个 CustomBootstrapper,它执行大量应用程序初始化,包括 IoC 注册和 Quartz 调度程序设置。这些模块还严重依赖于 SuperSimpleViewEngine

现在我需要对此进行测试,当然是使用 MSTest,而且现在每个人可能都已经知道这是行不通的。 Nancy 的人很早就发现了这个问题,并提供了这个解决方法:https://github.com/NancyFx/Nancy/wiki/Nancy-Testing-View-Location我认为这是可行的,因为当我在我的测试用例中尝试创建我的 Bootstrap 的实例时,它失败了,因为有多个 RootPathProviders。

所以解决方案似乎是使用 ConfigurableBootStrapper。所以我想唯一的问题是,如何确保 ConfigurableBootStrapper 的设置方式与我的 CustomBootStraper 相同?

最佳答案

        var browser = new Browser(cfg =>
        {
            cfg.RootPathProvider<YourRootPathProvider>();
            cfg.Module<YourModule>();
        });

关于c# - 在南希测试自定义 Bootstrap ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16104958/

相关文章:

c# - 使用 AddPicture 时 EPPlus Excel 错误

c# - 密码保护的 OpenXml Word 文档重新保存为密码保护的二进制 Word

firefox - 在 Firefox 中访问 IP 地址时发送主机头

Jenkins 与 MSTest 插件 : "mstest xml coverage report file not found"

C#自定义控件(圆形进度条)Xamarin Forms

c# - 在 32 位版本的 Windows (Teamcity) 上编译 x64

testing - 通过 "npm install"安装时找不到 Testcafe 命令

ruby-on-rails - 我是否正确使用工厂?

tfs - CustomizableOutDir=true 在 Team Build 期间中断 MSTest.exe

c# - 无法从 C++ 包装器在 MS 测试中加载文件或程序集 'log4net'