Esempio n. 1
0
        public async Task AddViaRulesToStations()
        {
            var data = new Timetable.Data()
            {
                Tocs      = new TocLookup(Substitute.For <ILogger>()),
                Locations = new Timetable.LocationData(
                    new[]
                {
                    TestLocations.Surbiton,
                    TestLocations.WaterlooMain,
                    TestLocations.WaterlooWindsor,
                    TestLocations.CLPHMJN,
                    TestLocations.CLPHMJC,
                    TestLocations.Woking,
                    TestLocations.Guildford
                }, Substitute.For <ILogger>(),
                    Timetable.Test.Data.Filters.Instance)
            };
            var loader = CreateLoader(darwin: MockDownloader);

            data = await loader.EnrichReferenceDataAsync(data, CancellationToken.None);

            data.Locations.TryGetStation("SUR", out Station surbiton);
            var rules = StationMapperTest.GetViaRules(surbiton);

            Assert.NotEmpty(rules);
        }
Esempio n. 2
0
        public async Task StationsHaveViaTextFromDarwin()
        {
            var loader = CreateCifLoader();
            var data   = new Timetable.Data()
            {
                Tocs      = new TocLookup(Substitute.For <ILogger>()),
                Locations = await loader.LoadStationMasterListAsync(CancellationToken.None)
            };

            var darwinLoader = await CreateDarwinLoader();

            data = await darwinLoader.EnrichReferenceDataAsync(data, CancellationToken.None);

            var locations = data.Locations as LocationData;

            Assert.NotEmpty(locations.Locations.Values.Where(s => StationMapperTest.GetViaRules(s).Any()));
        }