Exemplo n.º 1
0
        public void KnownInvalid()
        {
            Assembly asm = Assembly.GetExecutingAssembly();

            Stream xmlStream = asm.GetManifestResourceStream("JamesRiverLevel.Tests.XML.invalid.xml");

            var test = NWS.GetRiverInformation(xmlStream);

            Assert.IsNull(test);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        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");
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        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"]));
        }
Exemplo n.º 6
0
        public void InvalidObject()
        {
            var test = NWS.Parse(null);

            Assert.IsNull(test);
        }
Exemplo n.º 7
0
        public void BlankXML()
        {
            var test = NWS.GetRiverInformation(new MemoryStream(Encoding.Default.GetBytes(String.Empty)));

            Assert.IsNull(test);
        }