MSpec 和在 app.conf 中使用 appsettings 测试类存在问题

发布于 2024-10-11 05:16:00 字数 232 浏览 6 评论 0原文

一般来说,我对 MSpec 和 BDD 非常陌生,目前在让 mspec 传递通过 XML feed 查找员工数据的 Search 类时遇到困难。 url 的参数保存在 app.config 文件中,看起来好像没有访问 app.config 来获取配置设置。

否则,到目前为止,mspec 对于所有其他测试都运行良好,只是这一项是特殊的。

如果需要的话,我如何编写一个测试来利用或模仿配置文件访问?

谢谢

I'm very new to MSpec and BDD in general and are currently having trouble having mspec pass a Search class that looks up employee data via an XML feed. The parameters for the url are held in an app.config file and seems as if the app.config is not being accessed to obtain the config setting.

Otherwise mspec is running fine for all other tests so far its just this one particular.

How do I write a test to utilise or mimic if thats needed, for the config file access please ?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

星軌x 2024-10-18 05:16:00

您的生产代码项目(正在测试的项目)中可能有 app.config,请尝试在测试中添加相同的 app.config(具有 MSpecs 的项目)。

You probably have app.config in your production code project (project which is being tested), try adding the same app.config in Tests (project with MSpecs).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文