public void IsStopAtAlwaysFalseForPassingPoint(TimesToUse arrivalOrDeparture) { var stop = TestScheduleLocations.CreatePass(Surbiton, TestSchedules.Ten); var spec = CreateFindSpec(TestSchedules.Ten, arrivalOrDeparture); Assert.False(stop.IsStopAt(spec)); }
internal PublicSchedule(Station at, TimesToUse arrivalsOrDepartures, IComparer<Time> comparer) { Location = at; _arrivalsOrDepartures = arrivalsOrDepartures; _comparer = comparer; _services = new SortedList<Time, IService[]>(comparer); }
public void IsStopAtWorksForOrigin(Time stopDeparture, Time findTime, TimesToUse arrivalOrDeparture, bool expected) { var stop = TestScheduleLocations.CreateOrigin(Surbiton, stopDeparture); var spec = CreateFindSpec(findTime, arrivalOrDeparture); Assert.Equal(expected, stop.IsStopAt(spec)); }
public void IsStopAtWorksForSetdownOnly(Time stopArrival, Time findTime, TimesToUse arrivalOrDeparture, bool expected) { var stop = TestScheduleLocations.CreateSetdownOnlyStop(Surbiton, stopArrival); stop.WorkingDeparture = stopArrival.AddMinutes(1); var spec = CreateFindSpec(findTime, arrivalOrDeparture); Assert.Equal(expected, stop.IsStopAt(spec)); }
public void FindStop(Station station, Time time, TimesToUse arrivalOrDeparture) { var schedule = TestSchedules.CreateSchedule(); var find = CreateFindSpec(station, time, arrivalOrDeparture); Assert.True(schedule.TryFindStop(find, out var stop)); Assert.Equal(station, stop.Station); if (find.UseArrival) { IArrival arrival = (IArrival)stop; Assert.Equal(time, arrival.Time); } else { IDeparture departure = (IDeparture)stop; Assert.Equal(time, departure.Time); } }
public StopSpecification(Station location, Time time, DateTime onDate, TimesToUse arrivalOrDeparture) : this(location, time, onDate, TimesToUse.Departures == arrivalOrDeparture) { }
private StopSpecification CreateFindSpec(Station station, Time time, TimesToUse arrivalOrDeparture = TimesToUse.Departures) { return(new StopSpecification(station, time, MondayAugust12, arrivalOrDeparture)); }
public void IsStopAtIfLocationMatchesAndPublicTimeMatches(Time stopArrival, Time findTime, TimesToUse arrivalOrDeparture, bool expected) { var stop = TestScheduleLocations.CreateStop(Surbiton, stopArrival); var spec = CreateFindSpec(findTime, arrivalOrDeparture); Assert.Equal(expected, stop.IsStopAt(spec)); }
private StopSpecification CreateFindSpec(Time findTime, TimesToUse arrivalOrDeparture, Station atLocation = null) { atLocation = atLocation ?? Surbiton; return(new StopSpecification(atLocation, findTime, MondayAugust12, arrivalOrDeparture)); }
public void UseDepartureBasedUponTimesToUse(TimesToUse use, bool expected) { var spec = Create(use); Assert.Equal(expected, spec.UseDeparture); }
private StopSpecification Create(TimesToUse use) { return(new StopSpecification(TestStations.Surbiton, Time.NotValid, DateTime.Today, use)); }
public void UseArrivalBasedUponTimesToUse(TimesToUse use, bool expected) { var spec = Create(use); Assert.Equal(expected, spec.UseArrival); }