public void KnownInvalid() { Assembly asm = Assembly.GetExecutingAssembly(); Stream xmlStream = asm.GetManifestResourceStream("JamesRiverLevel.Tests.XML.invalid.xml"); var test = NWS.GetRiverInformation(xmlStream); Assert.IsNull(test); }
public void None() { Assembly asm = Assembly.GetExecutingAssembly(); Stream xmlStream = asm.GetManifestResourceStream("JamesRiverLevel.Tests.XML.good.xml"); var test = NWS.GetRiverInformation(xmlStream); var viewModel = NWS.Parse(test); Assert.AreEqual(WaterLevelAction.None, viewModel.ActionLevel); }
public void KnownGoodXML() { Assembly asm = Assembly.GetExecutingAssembly(); Stream xmlStream = asm.GetManifestResourceStream("JamesRiverLevel.Tests.XML.good.xml"); var test = NWS.GetRiverInformation(xmlStream); Assert.IsNotNull(test); Assert.AreEqual(test.id, "RMDV2"); }
public void Permit() { Assembly asm = Assembly.GetExecutingAssembly(); Stream xmlStream = asm.GetManifestResourceStream("JamesRiverLevel.Tests.XML.permit.xml"); var test = NWS.GetRiverInformation(xmlStream); var viewModel = NWS.Parse(test); Assert.AreEqual(WaterLevelAction.Permit, viewModel.ActionLevel); Assert.AreEqual(9.0f, viewModel.WaterLevel); Assert.AreEqual("ft", viewModel.WaterLevelUnit); }
public ActionResult Index() { if (HttpContext.Application["ViewModel"] == null || ((DisplayViewModel)HttpContext.Application["ViewModel"]).DataObtainedAt.AddSeconds(300) < DateTime.Now) { var results = NWS.GetRiverInformation(); var viewModel = NWS.Parse(results); HttpContext.Application["ViewModel"] = viewModel; } return(HttpContext.Application["ViewModel"] == null?View("Error") : View(HttpContext.Application["ViewModel"])); }
public void BlankXML() { var test = NWS.GetRiverInformation(new MemoryStream(Encoding.Default.GetBytes(String.Empty))); Assert.IsNull(test); }