private IEnumerable <TodoSpec> BuildStatus(IEnumerable <TodoStatus> statuses)
        {
            if (statuses.Count() == 0)
            {
                return(null);
            }

            return(statuses.Select(s => TodoSpecifications.ByStatus(s)));
        }
        private TodoSpec BuildExactly(DateTime when, bool?overdue)
        {
            var spec = TodoSpecifications.Due(when);

            if (overdue.HasValue)
            {
                spec = spec.And(BuildOverdue(overdue.Value, hasDueDate: null));
            }

            return(spec);
        }
        private TodoSpec BuildDateRange(DateTime?begin, DateTime?end)
        {
            if (begin.HasValue && end.HasValue)
            {
                return(TodoSpecifications.InDateRange(begin.Value, end.Value));
            }

            else if (begin.HasValue && !end.HasValue)
            {
                return(TodoSpecifications.DueAfter(begin.Value));
            }

            else if (!begin.HasValue && end.HasValue)
            {
                return(TodoSpecifications.DueBefore(end.Value));
            }
            else
            {
                return(null);
            }
        }
 private TodoSpec GetOverDue(bool overdue)
 {
     return(overdue ? TodoSpecifications.Overdue() : TodoSpecifications.NotOverdue());
 }