Esempio n. 1
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));
        }
Esempio n. 2
0
        public void IsStopAtIfLocationMatches(Location location, bool expected)
        {
            var stop = TestScheduleLocations.CreateStop(location, TestSchedules.Ten);
            var spec = CreateFindSpec(TestSchedules.Ten, TimesToUse.Arrivals, ClaphamJunction);

            Assert.Equal(expected, stop.IsStopAt(spec));
        }
Esempio n. 3
0
        private ScheduleStop CreateScheduleStop()
        {
            var stop = TestScheduleLocations.CreateStop(TestStations.Surbiton, TestSchedules.Ten);

            TestSchedules.CreateScheduleWithService(stops: new ScheduleLocation[] { stop });
            return(stop);
        }
Esempio n. 4
0
        public void MapStop()
        {
            var mapper = ToViewProfileConfiguration.CreateMapper();

            var stopDate = TestDate.AddDays(1);
            var input    = new ResolvedStop(
                TestScheduleLocations.CreateStop(
                    TestLocations.Surbiton,
                    new Time(TestTime.Ten)),
                stopDate);


            var output = Map(input);

            Assert.Equal("SUR", output.Location.ThreeLetterCode);
            var expected = stopDate.Add(TestTime.Ten);

            Assert.Equal(expected, output.Arrival);
            var expectedDeparture = expected.AddMinutes(1);

            Assert.Equal(expectedDeparture, output.Departure);
            Assert.Equal("10", output.Platform);
            Assert.Equal("T", output.Activities);
            Assert.Null(output.PassesAt);
        }
        private ScheduleLocation[] CreateMainStops()
        {
            var mainStops = TestSchedules.CreateThreeStopSchedule(TestSchedules.Ten);

            mainStops[2] = TestScheduleLocations.CreateStop(TestStations.Vauxhall, TestSchedules.TenTwenty);    // Make Vauxhall a stop
            return(mainStops);
        }
Esempio n. 6
0
        private ScheduleLocation[] CreateMainStops(Time departs)
        {
            var mainStops = TestSchedules.CreateFourStopSchedule(departs);

            mainStops[3] = TestScheduleLocations.CreateStop(TestStations.Vauxhall, TestSchedules.TenTwenty);    // Make Vauxhall a stop
            return(mainStops);
        }
Esempio n. 7
0
        private ScheduleStop CreateScheduleStop(Time time, string timetableId = "X12345", ICalendar calendar = null)
        {
            calendar = calendar ?? TestSchedules.EverydayAugust2019;
            var stop = TestScheduleLocations.CreateStop(TestStations.Surbiton, time);

            TestSchedules.CreateScheduleWithService(timetableId: timetableId, calendar: calendar, stops: new ScheduleLocation[] { stop });
            return(stop);
        }
Esempio n. 8
0
        public void OnlyIncludeStopsWhereAdvertisedStopIsRight(string activity, bool useArrivals, bool expected)
        {
            var stop = TestScheduleLocations.CreateStop(ClaphamJunction, TestSchedules.Ten, activity);

            var arrivalsDepartures = useArrivals ? TimesToUse.Arrivals : TimesToUse.Departures;
            var findAt             = useArrivals ? TestSchedules.Ten : TestSchedules.Ten.AddMinutes(1);
            var spec = CreateFindSpec(findAt, arrivalsDepartures, ClaphamJunction);

            Assert.Equal(expected, stop.IsStopAt(spec));
        }
        public void AddDayToScheduleStop()
        {
            var scheduleLocation = TestScheduleLocations.CreateStop(TestLocations.Surbiton, Test);

            scheduleLocation.AddDay(Start);

            Assert.Equal(Expected, scheduleLocation.Arrival);
            Assert.Equal(Expected.Subtract(ThirtySeconds), scheduleLocation.WorkingArrival);
            Assert.Equal(Expected.Add(OneMinute), scheduleLocation.Departure);
            Assert.Equal(Expected.Add(ThirtySeconds), scheduleLocation.WorkingDeparture);
        }
Esempio n. 10
0
        public void ReturnNullWhenInvalidTime()
        {
            var mapper = ToViewProfileConfiguration.CreateMapper();

            var input = TestScheduleLocations.CreateStop(
                TestLocations.Surbiton,
                Time.NotValid);

            var output = Map(input);

            Assert.Null(output.Arrival);
        }
Esempio n. 11
0
        public void NormalStopHasPublicDeparture()
        {
            IDeparture departure = TestScheduleLocations.CreateStop(TestStations.Surbiton, TestSchedules.Ten);

            Assert.True(departure.IsPublic);
        }
Esempio n. 12
0
        public void IsStopIfLocationMatches(Location location, int sequence, bool expected)
        {
            var stop = TestScheduleLocations.CreateStop(ClaphamJunction.Locations.First(), TestSchedules.Ten);

            Assert.Equal(expected, stop.IsStop(location, sequence));
        }
        public void IsAdvertisedStop(string activity, bool expected)
        {
            var stop = TestScheduleLocations.CreateStop(TestStations.Surbiton, TestSchedules.Ten, activity);

            Assert.Equal(expected, stop.IsAdvertised());
        }
        public void IsAssociatedConsistent(string activity, AssociationCategory category, bool expected)
        {
            var scheduleLocation = TestScheduleLocations.CreateStop(TestStations.Surbiton, Test, activity);

            Assert.Equal(expected, scheduleLocation.IsAssociatedConsistent(category));
        }
        public void ScheduleStopSetsStopTypeBasedUponActivities(string activity, PublicStop expected)
        {
            var scheduleLocation = TestScheduleLocations.CreateStop(TestStations.Surbiton, Test, activity);

            Assert.Equal(expected, scheduleLocation.AdvertisedStop);
        }
Esempio n. 16
0
        public void NormalStopHasPublicArrival()
        {
            IArrival arrival = TestScheduleLocations.CreateStop(TestStations.Surbiton, TestSchedules.Ten);

            Assert.True(arrival.IsPublic);
        }