Пример #1
0
        public void testValidation()
        {
            restServiceClient.PathFormat = "Meth={0}&location={1}&variable={2}";

            string varCode   = "HG"; // prep for many test
            string siteCode  = "01080";
            string beginDate = "2009-01-01";
            string endDate   = "2009-09-01";

            Type vType = typeof(TimeSeriesResponseType);

            restServiceClient.ResponseType = vType;
            parameters    = new string[5];
            parameters[0] = "getValues";
            parameters[1] = siteCode;
            parameters[2] = varCode;
            parameters[3] = beginDate;
            parameters[4] = endDate;

            FileStream file =
                File.OpenRead(
                    @"E:\Documents and Settings\valentin\My Documents\cuahsi\waterml\HydrologicDataExamples\Corps\timeSeries_01080_hg.xml");
            XmlReader         reader   = XmlReader.Create(file);
            XmlReaderSettings settings = new XmlReaderSettings();

            settings.CheckCharacters  = false;
            settings.IgnoreWhitespace = true;

            object res = restServiceClient.testValidation(reader);

            file.Close();

            Assert.IsInstanceOfType(vType, res);
            TimeSeriesResponseType response = (TimeSeriesResponseType)res;

            Assert.That(response.timeSeries.variable.variableCode[0].Value == varCode, "should match variabel code");
            //Assert.That(response.timeSeries.sourceInfo.variableCode[0].Value.Equals(varCode));

            Assert.That(response.timeSeries.values.value.Length > 1, "no values returned");
        }