public void CanTestFlatFileParsingWithFiles() { String tmp = Path.GetTempFileName(); String input = SaveToTemp("CSV_FF_RecvInput.txt"); SchemaTester <Schema3_FF> .ParseFF(input, tmp); Assert.IsTrue(File.Exists(tmp)); Assert.Greater(new FileInfo(tmp).Length, 0); }
public void CanTestFlatFileParsing() { Stream input = DocLoader.LoadStream("CSV_FF_RecvInput.txt"); Stream output = SchemaTester <Schema3_FF> .ParseFF(input); try { XmlDocument doc = new XmlDocument(); doc.Load(output); } catch (Exception ex) { Assert.Fail(ex.ToString()); } }
public void CanGetErrorInfoWhenFFParsingFails() { Stream input = DocLoader.LoadStream("CSV_FF_RecvInput_Bad.txt"); try { Stream output = SchemaTester <Schema3_FF> .ParseFF(input); MessageHelper.ConsumeStream(output); } catch (Exception ex) { String msg = ErrorHelper.GetErrorMessage(ex); Assert.That(msg, new ContainsConstraint("Unexpected data")); return; } Assert.Fail("Parsing should've thrown an error"); }