Esempio n. 1
0
        public async Task <TocLookup> UpdateTocsAsync(TocLookup lookup, CancellationToken token)
        {
            TrainOperatingCompanyList tocs = null;

            try
            {
                tocs = await _knowledgebase.GetTocs(token).ConfigureAwait(false);
            }
            catch (Exception e)
            {
                _logger.Warning(e, "Error loading Knowledgebase Tocs.");
            }

            if (tocs == null)
            {
                return(lookup);
            }

            foreach (var toc in tocs.TrainOperatingCompany)
            {
                try
                {
                    var t = TocMapper.Map(toc);
                    lookup.AddIfNotExist(toc.AtocCode, t);
                }
                catch (Exception e)
                {
                    _logger.Warning(e, "Error loading Knowledgebase Toc: {toc}.", toc.AtocCode);
                }
            }

            return(lookup);
        }
Esempio n. 2
0
        public async Task <TocLookup> UpdateTocsAsync(TocLookup tocs, CancellationToken token)
        {
            var refData = await GetReferenceData(token).ConfigureAwait(false);

            foreach (var toc in refData.TocRef)
            {
                var t = TocMapper.Map(toc);
                tocs.AddOrReplace(t.Code, t);
            }

            return(tocs);
        }
Esempio n. 3
0
        public void MapName()
        {
            var toc = TocMapper.Map(_avanti);

            Assert.Equal("Avanti West Coast", toc.Name);
        }
Esempio n. 4
0
        public void MapCode()
        {
            var toc = TocMapper.Map(_avanti);

            Assert.Equal("VT", toc.Code);
        }
Esempio n. 5
0
        public void Url()
        {
            var toc = TocMapper.Map(_avanti);

            Assert.Equal(@"http://www.nationalrail.co.uk/tocs_maps/tocs/VT.aspx", toc.NationalRailUrl);
        }