private IEnumerable <Date> GenerateForSinglePeriod(IPeriod period) { var dates = _from .Pick(period.Months()) .Match( some: from => period.Days().Where(date => date.IsGreaterOrEqualTo(from)), none: period.Days); return(_to .Pick(period.Months()) .Match( some: to => dates.Where(date => date.IsLessOrEqualTo(to)), none: () => dates)); }
private IEnumerable <Date> GenerateForSinglePeriod(IPeriod period) { var selectedPeriods = _monthsSelector.Match( some: monthSelector => monthSelector.Pick(period.Months()), none: () => (IEnumerable <IPeriod>) new[] { period }); return(_weeklySelections .SelectMany(weeklySelection => weeklySelection.Generate(selectedPeriods))); }