SubSonic 3:单元测试正常工作,但现在找不到连接字符串
我已经使用我的 Test 连接字符串设置了一堆 NUnit 单元测试App.config 文件 一切都工作正常。
然后突然间我的所有测试都停止工作并抛出相同的异常:
系统应用程序异常: 连接字符串 “应用程序服务”不存在
然而,这里是我的 App.config 文件的内容,其中缺少连接字符串清晰可见:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="ApplicationServices"
connectionString="Test"
providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>
还有其他人遇到过这个问题吗?如果有,您是如何解决这个问题的?
I had set up a bunch of NUnit unit tests using the Test connection string in my App.config file and everything was working fine.
Then all of a sudden all my tests stopped working and threw the same exception:
System.ApplicationException :
Connection string
'ApplicationServices' does not exist
Yet here are the contents of my App.config file with the missing connection string clearly visible:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="ApplicationServices"
connectionString="Test"
providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>
Has anyone else come across this and if so how did you get around it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定这是否是完全相同的问题,但我最近遇到了听起来非常相似的问题。我的 SubSonic 3 nunit 测试已经工作得很好一段时间了,直到我创建了一个大统一的 AllTests.nunit 项目文件,我用它把一堆单独的测试项目整合到一起。当我运行 AllTests.nunit 时,我在 SubSonic 项目中的测试开始失败,并出现与您所描述的完全相同的错误。
解决方案:除了 AllTests.nunit,我还创建了 AllTests.config,其内容如下:
希望有所帮助。
I'm not sure if this is exactly the same problem, but I ran into what sounds like a very similar issue recently. My SubSonic 3 nunit tests had been working just fine and dandy for some time, until I created one grand-unified AllTests.nunit project file that I used to pull a bunch of separate test projects together into one. When I ran AllTests.nunit, my tests in the SubSonic project began to fail with exactly the same error you're describing.
The solution: alongside AllTests.nunit, I created AllTests.config, the contents of which are as follows:
Hope that helps.