views:

53

answers:

1

Hello. 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.

+2  A: 

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

Adam