public void ToStringReturnsServiceAndStop()
        {
            var service = TestSchedules.CreateService();
            var stop    = new ResolvedServiceStop(service, service.Details.Locations[0]);

            Assert.Equal("X12345 2019-08-12 10:00 SUR-SURBITN", stop.ToString());
        }
        public void OnReturnsResolvedServiceOn()
        {
            var service = TestSchedules.CreateService();
            var stop    = new ResolvedServiceStop(service, service.Details.Locations[0]);

            Assert.Equal(TestDate, stop.On);
        }
        public void OperatorReturnsResolvedServiceOperator()
        {
            var service = TestSchedules.CreateService();
            var stop    = new ResolvedServiceStop(service, service.Details.Locations[0]);

            Assert.Equal("VT", stop.Operator.Code);
        }
        public void GoesToSetsViaTextToEmptyWhenNoViaRules206144637()
        {
            var service  = CreateViaTextTestSchedule();
            var surbiton = service.Details.Locations[0];
            var stop     = new ResolvedServiceStop(service, surbiton);

            Assert.Equal(String.Empty, stop.ViaText);
        }
        public void StopIsNextDay(Time startTime, bool expected)
        {
            var stops   = TestSchedules.CreateThreeStopSchedule(startTime);
            var service = TestSchedules.CreateService(stops: stops);
            var clapham = service.Details.Locations[1];
            var stop    = new ResolvedServiceStop(service, clapham);

            Assert.Equal(expected, stop.IsNextDay(true));
        }
        public void GoesToSetsViaTextWhenNoValidViaRule660668605()
        {
            var service  = CreateViaTextTestSchedule();
            var surbiton = service.Details.Locations[0];

            surbiton.Station.Add(CreateTestRule(destination: TestLocations.Woking));
            var stop = new ResolvedServiceStop(service, surbiton);

            Assert.Equal(String.Empty, stop.ViaText);
        }
        public void GoesToSetsViaTextWhenValidViaRule111740840()
        {
            var service  = CreateViaTextTestSchedule();
            var surbiton = service.Details.Locations[0];

            surbiton.Station.Add(CreateTestRule());
            var stop = new ResolvedServiceStop(service, surbiton);

            Assert.Equal("has via text", stop.ViaText);
        }
        public void GoesToWithNoAssociation()
        {
            var service = TestSchedules.CreateService();
            var clapham = service.Details.Locations[1];
            var stop    = new ResolvedServiceStop(service, clapham);

            Assert.True(stop.GoesTo(TestStations.Waterloo));
            Assert.False(stop.Association.IsIncluded);
            Assert.Equal(IncludedAssociation.NoAssociation, stop.Association);
        }
        public void OnlyDepartureNextDay(bool useDeparture, bool expected)
        {
            var stops   = TestSchedules.CreateThreeStopSchedule(new Time(new TimeSpan(23, 40, 0)));
            var service = TestSchedules.CreateService(stops: stops);
            var clapham = service.Details.Locations[1] as ScheduleStop;

            clapham.Departure = new Time(new TimeSpan(0, 5, 0)).AddDay();

            var stop = new ResolvedServiceStop(service, clapham);

            Assert.Equal(expected, stop.IsNextDay(useDeparture));
        }
        public void GoesToOnlyIfHasPublicArrival(string activity, bool expected)
        {
            var service  = TestSchedules.CreateService();
            var surbiton = service.Details.Locations[0];
            var clapham  = service.Details.Locations[1] as ScheduleStop;

            clapham.Activities = new Activities(activity);

            var stop = new ResolvedServiceStop(service, surbiton);

            Assert.Equal(expected, stop.GoesTo(clapham.Station));
            Assert.Equal(expected, stop.FoundToStop != null);
        }
Exemplo n.º 11
0
        public void ComesFromIsFalseIfNotPublicDeparture(string activity, bool expected)
        {
            var service  = TestSchedules.CreateService();
            var waterloo = service.Details.Locations[3];
            var clapham  = service.Details.Locations[1] as ScheduleStop;

            clapham.Activities = new Activities(activity);

            var stop = new ResolvedServiceStop(service, waterloo);

            Assert.Equal(expected, stop.ComesFrom(clapham.Station));
            Assert.Equal(expected, stop.FoundFromStop != null);
        }
        public void GoesTo(Station station, bool isTo)
        {
            var service = TestSchedules.CreateService();
            var clapham = service.Details.Locations[1];
            var stop    = new ResolvedServiceStop(service, clapham);

            if (isTo)
            {
                Assert.True(stop.GoesTo(station));
                Assert.NotNull(stop.FoundToStop);
            }
            else
            {
                Assert.False(stop.GoesTo(station));
                Assert.Null(stop.FoundToStop);
            }
        }
Exemplo n.º 13
0
        public FS Convert(ResolvedServiceStop source, FS destination, ResolutionContext context)
        {
            // var original = context.Items["On"];
            // context.Items["On"] = source.On;
            var item = new FS()
            {
                At          = context.Mapper.Map <Model.ScheduledStop>(source.Stop),
                To          = context.Mapper.Map <Model.ScheduledStop>(source.FoundToStop),
                From        = context.Mapper.Map <Model.ScheduledStop>(source.FoundFromStop),
                Association = context.Mapper.Map <Model.IncludedAssociation>(source.Association),
                ViaText     = source.ViaText
            };
            var service = Convert(source.Service, (S)null, context);

            SetService(item, service);

            return(item);
        }
Exemplo n.º 14
0
        private static void AssertArrival(DateTime expectedDate, TimeSpan expectedTime, ResolvedServiceStop stop)
        {
            var destination = stop.Stop.Stop as ScheduleStop;

            Assert.Equal(expectedTime, destination.Arrival.Value);
            Assert.Equal(expectedDate, stop.On);
        }
Exemplo n.º 15
0
        private static void AssertDeparture(DateTime expectedDate, TimeSpan expectedTime, ResolvedServiceStop stop)
        {
            var origin = stop.Stop.Stop as ScheduleStop;

            Assert.Equal(expectedTime, origin.Departure.Value);
            Assert.Equal(expectedDate, stop.On);
        }