Ejemplo n.º 1
0
        public static DateTime GetFutureDate(this IDataGenerator dataGenerator, int maximumYearsInTheFuture, int minimumYearsInTheFuture = 0)
        {
            var maxYear = dataGenerator.Today.Year + maximumYearsInTheFuture;
            var minYear = dataGenerator.Today.Year + minimumYearsInTheFuture;
            var month   = dataGenerator.Today.Month;
            var day     = dataGenerator.Today.Day;

            return(dataGenerator.GetDate(
                       new DateTime(minYear, month, Math.Min(day, DateTime.DaysInMonth(minYear, month))),
                       new DateTime(maxYear, month, Math.Min(day, DateTime.DaysInMonth(maxYear, month)))));
        }