public void LogCsvFileToDisk() { var mockFileOutputter = new MockFileOutputter(); var logger = new Logger(mockFileOutputter); DateTime d = DateTime.Parse("12/17/1978 05:34:22"); var dataToLog = new GuruData(d, 220.3f, 99.1f, float.NaN, float.NaN); logger.Log(dataToLog); Assert.AreEqual(1, mockFileOutputter.Rows.Count); Assert.AreEqual("05:34,220.3,99.1,NaN,NaN\n", mockFileOutputter.Rows[0]); }
public GuruData Fetch() { var now = m_source.GetCurrentTime(); var xml = m_source.Fetch(); XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); var data = new GuruData(); data.Timestamp = now; ParseTemp(doc, "//COOK_TEMP", out data.PitTemp); ParseTemp(doc, "//FOOD1_TEMP", out data.FoodTemp1); ParseTemp(doc, "//FOOD2_TEMP", out data.FoodTemp2); ParseTemp(doc, "//FOOD3_TEMP", out data.FoodTemp3); return(data); }
public void Log(GuruData dataToLog) { var row = String.Format("{0:HH:mm},{1},{2},{3},{4}\n", dataToLog.Timestamp, dataToLog.PitTemp, dataToLog.FoodTemp1, dataToLog.FoodTemp2, dataToLog.FoodTemp3); m_outputter.Output(row); }