public static IEnumerable <Message> GetValidationErrors(this Timetable me, Schedule schedule, ValidationOptions options) { var result = new List <Message>(); result.AddRange(me.EnsureStationHasTrack()); result.AddRange(me.Trains.SelectMany(t => t.CheckTrainTimeSequence())); if (options.ValidateStationTracks) { result.AddRange(me.Stations.SelectMany(s => s.Tracks).SelectMany(t => t.GetValidationErrors(schedule.LocoSchedules))); } if (options.ValidateStationCalls) { result.AddRange(me.Stations.SelectMany(s => s.Calls).SelectMany(c => c.GetValidationErrors())); } if (options.ValidateStretches) { result.AddRange(me.Stations.SelectMany(s => s.Stretches).SelectMany(ss => ss.GetValidationErrors()).Distinct()); } if (options.ValidateTrainSpeed) { result.AddRange(me.CheckTrainSpeed(options.MinTrainSpeedMetersPerClockMinute, options.MaxTrainSpeedMetersPerClockMinute)); } return(result); }