private static Dictionary <string, object> TryParsing(IMetarChunkDecoder chunkDecoder, bool strict, string remainingMetar, bool withCavok) { Dictionary <string, object> decoded; try { decoded = chunkDecoder.Parse(remainingMetar, withCavok); } catch (MetarChunkDecoderException primaryException) { if (strict) { throw; } else { try { //the PHP version of ConsumeOneChunk implements an additional, unused strict flag var alternativeRemainingMetar = MetarChunkDecoder.ConsumeOneChunk(remainingMetar); decoded = chunkDecoder.Parse(alternativeRemainingMetar, withCavok); decoded.Add(ExceptionKey, primaryException); } catch (MetarChunkDecoderException) { throw primaryException; } } } return(decoded); }
public void ConsumeOneChunkTest() { var result = MetarChunkDecoder.ConsumeOneChunk(TestMetarSource[0]); Assert.AreEqual("231027Z AUTO 24004G09MPS 2500 1000NW R32/0400 R08C/0004D +FZRA VCSN //FEW015 17/10 Q1009 REFZRA WS R03", result); }