Ejemplo n.º 1
0
        public void IsStopAtAlwaysFalseForPassingPoint(TimesToUse arrivalOrDeparture)
        {
            var stop = TestScheduleLocations.CreatePass(Surbiton, TestSchedules.Ten);
            var spec = CreateFindSpec(TestSchedules.Ten, arrivalOrDeparture);

            Assert.False(stop.IsStopAt(spec));
        }
Ejemplo n.º 2
0
 internal PublicSchedule(Station at, TimesToUse arrivalsOrDepartures, IComparer<Time> comparer)
 {
     Location = at;
     _arrivalsOrDepartures = arrivalsOrDepartures;
     _comparer = comparer;
     _services = new SortedList<Time, IService[]>(comparer);
 }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        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);
            }
        }
Ejemplo n.º 6
0
 public StopSpecification(Station location, Time time, DateTime onDate, TimesToUse arrivalOrDeparture) :
     this(location, time, onDate, TimesToUse.Departures == arrivalOrDeparture)
 {
 }
Ejemplo n.º 7
0
 private StopSpecification CreateFindSpec(Station station, Time time,
                                          TimesToUse arrivalOrDeparture = TimesToUse.Departures)
 {
     return(new StopSpecification(station, time, MondayAugust12, arrivalOrDeparture));
 }
Ejemplo n.º 8
0
        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));
        }
Ejemplo n.º 9
0
 private StopSpecification CreateFindSpec(Time findTime, TimesToUse arrivalOrDeparture, Station atLocation = null)
 {
     atLocation = atLocation ?? Surbiton;
     return(new StopSpecification(atLocation, findTime, MondayAugust12, arrivalOrDeparture));
 }
Ejemplo n.º 10
0
        public void UseDepartureBasedUponTimesToUse(TimesToUse use, bool expected)
        {
            var spec = Create(use);

            Assert.Equal(expected, spec.UseDeparture);
        }
Ejemplo n.º 11
0
 private StopSpecification Create(TimesToUse use)
 {
     return(new StopSpecification(TestStations.Surbiton, Time.NotValid, DateTime.Today, use));
 }
Ejemplo n.º 12
0
        public void UseArrivalBasedUponTimesToUse(TimesToUse use, bool expected)
        {
            var spec = Create(use);

            Assert.Equal(expected, spec.UseArrival);
        }