Subsonic 3.0 TestRepository“查找”不工作
使用 Subsonic 3,我有一个名为“ConferenceRepository”的简单类,它有一个根据状态返回一堆会议的方法。我正在使用 SubSonic 的内置测试支持对此进行测试。我的存储库设置如下所示:
// 2 Approved, 4 pending, 3 rejected
var data = new List<Conference>
{
new Conference {Approved = true, Rejected = false},
new Conference {Approved = true, Rejected = false},
new Conference {Approved = false, Rejected = false},
new Conference {Approved = false, Rejected = false},
new Conference {Approved = false, Rejected = false},
new Conference {Approved = false, Rejected = false},
new Conference {Approved = false, Rejected = true},
new Conference {Approved = false, Rejected = true},
new Conference {Approved = false, Rejected = true}
};
Conference.ResetTestRepo();
Conference.Setup(data);
然后我的 Repo 类最终使用 Find() 执行这一行:
return Conference.Find(c => c.Approved).ToList();
问题是,这总是返回所有记录 (9)。我尝试过不同的查找标准,但无济于事。
有人知道问题是什么吗?我已尝试修复 tt 模板中的相等比较,如下所述:修复问题使用 SubSonic 3 的 TestRepository 但这没有帮助。
Using Subsonic 3, I have a simple class called "ConferenceRepository" that has a method that returns a bunch of conferences based on their status. I am testing this using SubSonic's built in support for testing. My setup of the repo looks like this:
// 2 Approved, 4 pending, 3 rejected
var data = new List<Conference>
{
new Conference {Approved = true, Rejected = false},
new Conference {Approved = true, Rejected = false},
new Conference {Approved = false, Rejected = false},
new Conference {Approved = false, Rejected = false},
new Conference {Approved = false, Rejected = false},
new Conference {Approved = false, Rejected = false},
new Conference {Approved = false, Rejected = true},
new Conference {Approved = false, Rejected = true},
new Conference {Approved = false, Rejected = true}
};
Conference.ResetTestRepo();
Conference.Setup(data);
And then my Repo class eventually executes this line, using Find():
return Conference.Find(c => c.Approved).ToList();
Trouble is, this always returns all the records (9). I've tried different find criteria, to no avail.
Anyone know what the issue is? I've tried fixing equality comparison in the tt templates as described here: Fixes for problems with SubSonic 3's TestRepository but that doesn't help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
因此从 .Find 更改为...
解决了这个问题。
So changing from .Find to...
Solves it.
应该没有什么区别,但你尝试过吗:
Shouldn't make any difference, but did you tried: