I have the following property:
public double TotalHours
{
get
{
return (from session in sessions
let ts = session.End.Subtract(session.Start)
select ts.TotalHours).Sum();
}
}
The property should sum all hours done in all sessions.
What do I need to test in order to ensure that the property is always summing all the hours from all sessions?
It’s basically a case of working out appropriate sample data. For example, you might want to try tests for:
Maybe you’ve got other data validation to ensure that the “dodgy-sounding” situations don’t occur, but those are the kinds of things I’d think about.