subsonic unit testing bug?

痞子三分冷 提交于 2019-12-12 04:00:48

问题


I'm currently using Subsonic 3.03 Active Record repository.

I have setup a Test connection string to utilise the dummy internal storage.

    [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);
    }

I'm expecting this unit-test to pass, but it pulls out the first service job and fails. I've also experienced problems using other sugar methods such as .Find().

It works fine when using the IQueryable interface such as ServiceJob.All.Where(s => s.ServiceJobID == 2) but don't fancy stripping out the sugar for testing purposes!

Great product by the way, really impressed so far.


回答1:


As you say this looks like it's definitely a bug. You should submit it as an issue to github:

http://github.com/subsonic/SubSonic-3.0/issues



来源:https://stackoverflow.com/questions/1232405/subsonic-unit-testing-bug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!