/// <summary> /// To store temparature details into hashtable /// </summary> /// <returns>return the operation true or not</returns> public static bool addTemperatureData() { bool status = false; try { string[] dateAndTemperature = getQueryForInsertDateWithTemperature(); if (dateAndTemperature[0] != "00/00/0000") { if (TemperatureReport.addTemperatureDataToHashTable(dateAndTemperature) == true) { askQuery(); status = true; } else { addTemperatureData(); status = false; } } else { getQueryForInsertDateWithTemperature(); } } catch (Exception dataNotStored) { Console.WriteLine(dataNotStored); } return(status); }
public void addData() { try { bool check = TemperatureReport.addTemperatureDataToHashTable(new string[] { "7/7/2018", "23c,100f" }); bool check1 = TemperatureReport.addTemperatureDataToHashTable(new string[] { "7/7/2018" }); Assert.IsTrue(check); Assert.IsFalse(check1); } catch (Exception e) { StringAssert.Contains(e.Message, "File Not Found Exception"); return; } }