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); }
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); }
public void MapName() { var toc = TocMapper.Map(_avanti); Assert.Equal("Avanti West Coast", toc.Name); }
public void MapCode() { var toc = TocMapper.Map(_avanti); Assert.Equal("VT", toc.Code); }
public void Url() { var toc = TocMapper.Map(_avanti); Assert.Equal(@"http://www.nationalrail.co.uk/tocs_maps/tocs/VT.aspx", toc.NationalRailUrl); }