public void TestParseInvalid() { // launch decoding (forecast was cancelled) var d = TafDecoder.ParseNotStrict("TAF LFMT 032244Z 0318/0206 CNL"); Assert.IsFalse(d.IsValid); // launch decoding (surface wind is invalid) d = TafDecoder.ParseNotStrict("TAF TAF LIRU 032244Z 0318/0420 2300ABKT PSSM\nBKN020CB TX05/0318Z TNM03/0405Z\n"); Assert.IsFalse(d.IsValid); }
public void TestParseErrors(Tuple <string, Type, string> source) { // launch decoding DecodedTaf decodedTaf = TafDecoder.ParseNotStrict(source.Item1); // check the error triggered Assert.NotNull(decodedTaf); Assert.False(decodedTaf.IsValid, "DecodedTaf should be invalid."); var errors = decodedTaf.DecodingExceptions; Assert.AreEqual(source.Item2, errors.FirstOrDefault().ChunkDecoder.GetType(), "ChunkDecoder type is incorrect."); Assert.AreEqual(source.Item3, errors.FirstOrDefault().RemainingTaf, "RemainingTaf is incorrect."); decodedTaf.ResetDecodingExceptions(); Assert.AreEqual(0, decodedTaf.DecodingExceptions.Count, "DecodingExceptions should be empty."); }