Example #1
0
        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);
        }
Example #2
0
        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"]));
        }
Example #4
0
        public void InvalidObject()
        {
            var test = NWS.Parse(null);

            Assert.IsNull(test);
        }