public void CanReadStock() { StockIO io = new StockIO(); String hpData = "HP" + NL + "11.4" + NL + "10" + NL; String yhooData = "YHOO" + NL + "57.2" + NL + "30" + NL; StringReader data = new StringReader(hpData); Stock loaded = io.ReadStock(data); Assert.AreEqual(hp, loaded); data = new StringReader(yhooData); loaded = io.ReadStock(data); Assert.AreEqual(yhoo, loaded); }
public void CanWriteToFile() { FileInfo output = new FileInfo("stockout.txt"); try { StockIO io = new StockIO(); io.WriteStock(output, hp); Assert.IsTrue(output.Exists); Stock loaded = io.ReadStock(output); Assert.AreEqual(hp, loaded); } finally { output.Delete(); } }