コード例 #1
0
        public void LocationHasMultipleServicesForWhenOnSameTime()
        {
            var surbiton = TestStations.Surbiton;
            var waterloo = TestStations.Waterloo;

            var locations1 = new[]
            {
                (ScheduleLocation)TestScheduleLocations.CreateOrigin(surbiton, TestSchedules.Ten),
                TestScheduleLocations.CreateDestination(waterloo, TestSchedules.TenThirty)
            };
            var service1 = TestSchedules.CreateScheduleWithService(timetableId: "A00001", stops: locations1);

            var locations2 = new[]
            {
                (ScheduleLocation)TestScheduleLocations.CreateOrigin(surbiton, TestSchedules.Ten),
                TestScheduleLocations.CreateDestination(waterloo, TestSchedules.TenThirty)
            };
            var service2 = TestSchedules.CreateScheduleWithService(timetableId: "A00002", stops: locations2);

            var destination = service1.Locations.Last().Station.Timetable;

            var arrivals = destination.GetArrivalTimes();
            var services = arrivals.GetServices(TestSchedules.TenThirty);

            Assert.Equal(2, services.Length);
        }
コード例 #2
0
        public void IsStopAtWorksForDestination(Time stopArrival, Time findTime, TimesToUse arrivalOrDeparture, bool expected)
        {
            var stop = TestScheduleLocations.CreateDestination(Surbiton, stopArrival);
            var spec = CreateFindSpec(findTime, arrivalOrDeparture);

            Assert.Equal(expected, stop.IsStopAt(spec));
        }
コード例 #3
0
        public void AddDayToScheduleDestination()
        {
            var scheduleLocation = TestScheduleLocations.CreateDestination(TestStations.Surbiton, Test);

            scheduleLocation.AddDay(Start);

            Assert.Equal(Expected, scheduleLocation.Arrival);
            Assert.Equal(Expected.Subtract(ThirtySeconds), scheduleLocation.WorkingArrival);
        }
コード例 #4
0
        public void LocationHasNoEntryForPassing()
        {
            var locations = new[]
            {
                (ScheduleLocation)TestScheduleLocations.CreateOrigin(TestStations.Surbiton, TestSchedules.Ten),
                TestScheduleLocations.CreatePass(TestStations.ClaphamJunction, TenFifteen),
                TestScheduleLocations.CreateDestination(TestStations.Waterloo, TestSchedules.TenThirty)
            };

            var testSchedule = TestSchedules.CreateScheduleWithService(stops: locations);

            var passing = locations[1].Station.Timetable;

            AssertNoArrivalTime(passing, TenFifteen);
            AssertNoDepartureTime(passing, TenFifteen);
        }
コード例 #5
0
        public void GoesToWorksWithSplitsWhereMainTerminatesAtSplitPoint()
        {
            //  Stop at Clapham
            var mainStops = CreateMainStops();

            mainStops = new [] {
                mainStops[0],
                TestScheduleLocations.CreateDestination(TestStations.ClaphamJunction, TestSchedules.TenFifteen)
            };
            var association = CreateSplitServices(mainStops);

            var at    = new StopSpecification(TestStations.Surbiton, TestSchedules.Ten, MondayAugust12, TimesToUse.Departures);
            var found = association.Main.Service.TryFindScheduledStop(at, out var stop);

            Assert.True(stop.GoesTo(TestStations.Woking));
            Assert.NotNull(stop.FoundToStop);
            Assert.True(stop.Association.IsIncluded);
        }
コード例 #6
0
        public void ComesFromWorksWithJoinsWhereMainEndsAtJoinPoint()
        {
            //  Ends at Clapham
            var mainStops = CreateMainStops();

            mainStops = new [] {
                mainStops[0],
                TestScheduleLocations.CreateDestination(TestStations.ClaphamJunction, TestSchedules.TenFifteen)
            };
            var association = CreateJoinServices(mainStops);

            var at    = new StopSpecification(TestStations.ClaphamJunction, TestSchedules.TenFifteen, MondayAugust12, TimesToUse.Arrivals);
            var found = association.Main.Service.TryFindScheduledStop(at, out var stop);

            Assert.True(stop.ComesFrom(TestStations.Woking));
            Assert.NotNull(stop.FoundFromStop);
            Assert.True(stop.Association.IsIncluded);
        }
コード例 #7
0
        public void MapScheduleDestination()
        {
            var mapper = ToViewProfileConfiguration.CreateMapper();

            var input = TestScheduleLocations.CreateDestination(
                TestLocations.WaterlooMain,
                new Time(TestTime.Ten));

            var output = Map(input);

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

            Assert.Equal(expected, output.Arrival);
            Assert.Equal("2", output.Platform);
            Assert.Equal("TF", output.Activities);
            Assert.Null(output.PassesAt);
            Assert.Null(output.Departure);
        }
コード例 #8
0
        public void GoesToWorksWithJoinsWhereMainStopsAtJoinPoint()
        {
            //  Ends at Clapham
            var mainStops = CreateMainStops();

            mainStops = new [] {
                mainStops[0],
                TestScheduleLocations.CreateDestination(TestStations.ClaphamJunction, TestSchedules.TenFifteen)
            };
            var association = CreateJoinServices(mainStops);

            var at    = new StopSpecification(TestStations.Woking, TestSchedules.NineForty, MondayAugust12, TimesToUse.Departures);
            var found = association.Associated.Service.TryFindScheduledStop(at, out var stop);

            // Neither train goes beyond Clapham so actually whole journey on join
            Assert.True(stop.GoesTo(TestStations.ClaphamJunction));
            Assert.NotNull(stop.FoundToStop);
            Assert.False(stop.Association.IsIncluded);
        }
コード例 #9
0
        public void LocationHasArrivalOnlyForSetdownOnlyStop()
        {
            var locations = new[]
            {
                (ScheduleLocation)TestScheduleLocations.CreateOrigin(TestStations.Surbiton, TestSchedules.Ten),
                TestScheduleLocations.CreateSetdownOnlyStop(TestStations.ClaphamJunction, TenFifteen),
                TestScheduleLocations.CreateDestination(TestStations.Waterloo, TestSchedules.TenThirty)
            };

            var testSchedule = TestSchedules.CreateScheduleWithService(stops: locations);

            var stop = locations[1].Station.Timetable;

            var arrivals = stop.GetArrivalTimes();
            var service  = arrivals.GetService(TenFifteen);

            Assert.Equal(testSchedule.Service, service);

            AssertNoDepartureTime(stop, TenFifteen);
        }
コード例 #10
0
        public void ScheduleDestinationStopTypeIsDestination()
        {
            var scheduleLocation = TestScheduleLocations.CreateDestination(TestStations.Surbiton, Test);

            Assert.Equal(PublicStop.SetDownOnly, scheduleLocation.AdvertisedStop);
        }
コード例 #11
0
        public void DestinationStopHasPublicArrival()
        {
            IArrival arrival = TestScheduleLocations.CreateDestination(TestStations.Surbiton, TestSchedules.Ten);

            Assert.True(arrival.IsPublic);
        }