Fitnesse Slim 查询测试在尝试访问 linq datacontext 时失败

发布于 2024-09-07 04:16:01 字数 267 浏览 2 评论 0原文

我编写了一个使用 linq 获取对象列表的查询。该代码在项目中执行良好,但当我尝试从fitnesse项目访问它时失败。 基(全局::System.Configuration.ConfigurationManager.ConnectionStrings [“ConnectionString”].ConnectionString,mappingSource) 我猜这与连接字符串有关,但我不知道如何为fitnesse项目单独指定连接字符串。项目和fitnesse项目都是同一解决方案的一部分。 有什么想法吗? 谢谢, 珍妮

I wrote a query that gets a list of objects using linq. The code executes fine in the project, but fails when I try to access it from the fitnesse project.
base(global::System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString, mappingSource)
I guess it has something to do with the connection string, but I don't know how to specify the connection string separately for the fitnesse project. Both project and fitnesse project are part of the same solution.
Any ideas?
Thanks,
Jenny

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

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

发布评论

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

评论(2

零度℉ 2024-09-14 04:16:04

谢谢,我已经尝试添加 suite.config,然后将应用程序配置添加到我的 c:\fitnesse 文件夹 - .jar 文件所在的位置。

我将 -c 选项 c:\Fitnesse\suite.config 添加到测试页面上的命令部分。
这是 suite.config 文件:

c:\fitnesse\myapp.config

^.svn$

这是 myapp.config 文件:

此处测试仍然失败:

public MyDataContext() :
基(全局::System.Configuration.ConfigurationManager.ConnectionStrings[“mycon”].ConnectionString,mappingSource)
{
OnCreated();
}

Thanks, I already tried adding a suite.config and then app config to my c:\fitnesse folder - where the .jar file is.

I added -c option c:\Fitnesse\suite.config to the command section on the test page.
Here's the suite.config file:

c:\fitnesse\myapp.config

^.svn$

Here's the myapp.config file:

The test still fails here:

public MyDataContext() :
base(global::System.Configuration.ConfigurationManager.ConnectionStrings["mycon"].ConnectionString, mappingSource)
{
OnCreated();
}

雨的味道风的声音 2024-09-14 04:16:03

您需要指定在哪里查找应用程序配置文件:

http://www.syterra.com/ Slim/AppConfigFiles.html

You need to specify where to find the app config file:

http://www.syterra.com/Slim/AppConfigFiles.html

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