亚音速单元测试错误? [英] subsonic unit testing bug?

查看:26
本文介绍了亚音速单元测试错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用的是 Subsonic 3.03 Active Record 存储库.

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

我期待这个单元测试通过,但它拉出第一个服务作业并失败.我在使用其他糖方法(例如 .Find())时也遇到过问题.

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().

在使用 IQueryable 接口(例如 ServiceJob.All.Where(s => s.ServiceJobID == 2))时它工作正常,但不要为了测试目的而去掉糖!

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.

推荐答案

正如你所说,这看起来绝对是一个错误.您应该将其作为问题提交给 github:

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

这篇关于亚音速单元测试错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆