예제 #1
0
 /// <summary>
 /// Gather all services
 /// </summary>
 /// <param name="onDate"></param>
 /// <param name="filter"></param>
 /// <param name="dayBoundary"></param>
 /// <returns>All services for day</returns>
 /// <remarks>Reuses standard Gather functionality, setting starting index to 0 and config to get all (actually lots) </remarks>
 public ResolvedServiceStop[] AllServices(DateTime onDate, GatherConfiguration.GatherFilter filter, Time dayBoundary)
 {
     var first = FindNearestTime(dayBoundary);
     
     var config = new GatherConfiguration(0, 0, true, filter);
     var gatherer = new ScheduleGatherer(this, config, _arrivalsOrDepartures);
     return gatherer.Gather(first.index, onDate.Date);
 }
        private ILocationData CreateStubDataWithAllArrivals(string atLocation = null, DateTime?atTime = null,
                                                            GatherConfiguration.GatherFilter config = null, Time?boundary = null, FindStatus returnedStatus = FindStatus.Success, ResolvedServiceStop[] returnedStops = null)
        {
            atLocation    = atLocation ?? Arg.Any <string>();
            atTime        = atTime ?? Arg.Any <DateTime>();
            config        = config ?? Arg.Any <GatherConfiguration.GatherFilter>();
            returnedStops = returnedStops ?? new [] { CreateClaphamResolvedStop() };
            boundary      = boundary ?? Time.Midnight;

            var data = Substitute.For <ILocationData>();

            data.AllArrivals(atLocation, atTime.Value, config, boundary.Value)
            .Returns((returnedStatus, returnedStops));
            data.Filters
            .Returns(Timetable.Test.Data.Filters.Instance);
            return(data);
        }
예제 #3
0
 public (FindStatus status, ResolvedServiceStop[] services) AllArrivals(string location, DateTime onDate,
                                                                        GatherConfiguration.GatherFilter filter, Time dayBoundary)
 {
     return(Find(location, (station) => station.Timetable.AllArrivals(onDate, filter, dayBoundary)));
 }
예제 #4
0
 /// <summary>
 /// Scheduled services arriving on date
 /// </summary>
 /// <param name="onDate">Date and Time</param>
 /// <param name="filter">Any filter</param>
 /// <param name="dayBoundary"></param>
 /// <returns>Schedules of running services.</returns>
 public ResolvedServiceStop[] AllArrivals(DateTime onDate, GatherConfiguration.GatherFilter filter, Time dayBoundary)
 {
     return(_arrivals.AllServices(onDate, filter, dayBoundary));
 }
예제 #5
0
 public GatherConfiguration.GatherFilter ProvidedByToc(TocFilter filter, GatherConfiguration.GatherFilter innerFilter)
 {
     return(filter.NoFilter ?
            innerFilter :
            (s => innerFilter(s).Where(SuppressExceptions(service => filter.IsValid(service.Operator)))));
 }