【发布时间】:2009-08-05 10:35:28
【问题描述】:
我目前正在使用 Subsonic 3.03 Active Record 存储库。
我已经设置了一个 Test 连接字符串来利用虚拟内部存储。
[TestInitialize]
public void TestInitialize()
{
List<ServiceJob> jobs = new List<ServiceJob>()
{
new ServiceJob() { ServiceJobID = 1 },
new ServiceJob() { ServiceJobID = 2 }
};
ServiceJob.Setup(jobs);
}
[TestMethod]
public void TestMethod()
{
ServiceJob job = ServiceJob.SingleOrDefault(s => s.ServiceJobID == 2);
Assert.AreEqual(2, job.ServiceJobID);
}
我希望这个单元测试能够通过,但它退出了第一个服务作业并失败了。 我在使用 .Find() 等其他糖类方法时也遇到过问题。
在使用 IQueryable 接口(例如 ServiceJob.All.Where(s => s.ServiceJobID == 2) 时它可以正常工作,但不要为了测试目的而剥离糖!
顺便说一句,很棒的产品,到目前为止真的给我留下了深刻的印象。
【问题讨论】:
-
我也遇到过同样的问题:stackoverflow.com/questions/1341073/… - 你提交了错误报告吗?
-
我会,但是 github 页面没有从我的盒子完全加载。