Testing a (big) collection retrieved from a db
        Posted  
        
            by Bas
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Bas
        
        
        
        Published on 2010-05-06T09:25:52Z
        Indexed on 
            2010/05/06
            9:28 UTC
        
        
        Read the original article
        Hit count: 320
        
I'm currently doing integration testing on a live database and I have the following sql statement:
var date = DateTime.Parse("01-01-2010 20:30:00");
var result = datacontext.Repository<IObject>().Where(r => r.DateTime > date).First();
Assert.IsFalse(result.Finished);
I need to test if the results retrieved from the statement, where the given date is less then the date of the object, have Finished set to False. I do not know how many results I get back and currently I'm getting the first object of the list and check if that object has Finished set to false. I know testing only the first item of the list is not valid testing, as a solution for that I could iterate through the list and check all items on Finished, but putting logic in a Test is kinda going against the concept of writing 'good' tests.
So my question is:
Does anyone have a good solution of how to properly test the results of this list?
© Stack Overflow or respective owner