示例#1
0
        /// <summary>
        /// Converts the pre-formatted string into the one or more StationInfo objects
        /// objects
        /// </summary>
        /// <param name="data"></param>
        /// <param name="icaos"></param>
        /// <returns></returns>
        private List <StationInfoDto> ConvertToDTO(string data,
                                                   IList <string> icaos = null)
        {
            if (icaos == null)
            {
                icaos = new List <string>();
            }

            IParser <StationInfoDto> parser = null;

            if (_parserType == ParserType.XML)
            {
                parser = new ParseStationInfoXML();
            }
            else
            {
                parser = new ParseStationInfoCSV();
            }

            return(parser.Parse(data, icaos));
        }
示例#2
0
        public void Parse_MultipleStations()
        {
            var parser   = new ParseStationInfoXML();
            var stations = parser.Parse(Resource.KIAD_ORBB_ZBAA_StationInfo_XML, new[] { "KIAD", "ORBB", "ZBAA" });

            stations.Count.Should().Be(3);
            stations[0].ICAO.Should().Be("KIAD");
            stations[1].ICAO.Should().Be("ORBB");
            stations[2].ICAO.Should().Be("ZBAA");

            var station = stations[0];

            station.Country.Should().Be("US");
            station.State.Should().Be("VA");
            station.WMOID.Should().Be(72403);
            station.Name.Should().Be("WASH DC/DULLES");
            station.SiteType.Count.Should().Be(3);
            station.SiteType.Should().Contain(SiteType.METAR);
            station.SiteType.Should().Contain(SiteType.TAF);
            station.SiteType.Should().Contain(SiteType.Rawinsonde);
            station.GeographicData.Latitude.Should().Be(38.93f);
            station.GeographicData.Longitude.Should().Be(-77.45f);
            station.GeographicData.Elevation.Should().Be(93.0f);
        }