public void ParseInCard_FieldIsNull() { string data = "r:533|t:15.09|h:0|pt:19.43|p:983.65|g:10.60=r:470|t:15.08|h:84.22|pt:19.41|p:983.53|g:6.62=r:477|t:15.11|h:84.61|pt:19.41|p:983.61|g:21.19="; HistoryCard presentCard = new HistoryCard() { Temperature = 15, Humidity = 84.33f, Pressure = 983.6f, Radiation = 12.8f, Description = "-", WindDirection = "-", WindSpeed = 0 }; var card = ParserMeteoData.ParseInCard(data); CheckHistoryCard(presentCard, card); }
public ActionResult MeteoData(string data) { //string data = "r:533|t:15.09|h:84.17|pt:19.43|p:983.65|g:10.60=r:470|t:15.08|h:84.22|pt:19.41|p:983.53|g:6.62=r:477|t:15.11|h:84.61|pt:19.41|p:983.61|g:21.19="; if (data != null) { HistoryCard historyCard = ParserMeteoData.ParseInCard(data); historyCard.DateTime = DateTime.Now; if (DataValidation.AllValidation(historyCard)) { db.HistoryCards.Add(historyCard); db.SaveChanges(); } } return(RedirectToAction("OpenWeatherData")); }