开发者

Subsonic 3.0 TestRepository "Find" not working

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},
      开发者_StackOverflow中文版             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.


So changing from .Find to...

return Conference.All().Where(c => c.Approved == true).ToList(); 

Solves it.


Shouldn't make any difference, but did you tried:

return Conference.Find(c => c.Approved == true).ToList(); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜